While working on a PHP script on a CentOS Linux server that runs from crontab I ran into an issue where PHP was bogging the server down because of memory use. The script has a lot of output that is not necessary to store though when using the exec function within the PHP script it was storing the unneeded output to an away which I believe was causing the memory usage problem. At first I thought I simply needed to modify the memory_limit setting within php.ini however that was not the true issue at hand. Below I describe two items to look at modifying if you run into a similar issue.
Earlier tonight I created a little script that will run in cron on a Linux server. The script counts the number of directories and files in a specific directory and if the count is above Y then it deletes directories and files older than X number of days. In the example script below the number of items (directories and files) that have to be located in the directory before the script to delete files older than a specific date is 10. If there are ten items then the script will delete items older than 90 days. Below the script is the entry made in a specific users cron on the Linux server.