Description
In select instances, a PHP web application, if not configured properly, will begin to accumulate unnecessary PHP Session files that start to grow in size and will eventually lead to maxing out a partition in disk usage.
This commonly occurs in CMS's such as WordPress or Joomla that may have plugins that do not follow efficient coding standards in deleting unused PHP Session files.
Resolution
To resolve this, cPanel has developed an internal script that will identify the session path by parsing the PHP.ini file, which would clean/remove any unused PHP session files in the configured directory.
To accomplish this, you would need to execute the below script:
# /usr/local/cpanel/scripts/clean_user_php_sessions
By default, the script will search for PHP session files in the following naming convention:
/sess_.*/
If your web application is configured to store the PHP session files in a different format, this would need to be adjusted by passing in a regex as the second parameter.
Example:
/usr/local/cpanel/scripts/clean_user_php_sessions 'ci_session\w+$'
To learn more about the script, you can review the below documentation:
https://docs.cpanel.net/whm/scripts/the-clean_user_php_sessions-script/
Comments
0 comments
Article is closed for comments.