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.
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:
By default, the script will search for PHP session files in the following naming convention:
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.
To learn more about the script, you can review the below documentation: