How do I know if there is a CRON working on the PHP 5.3 (Centos) garbage collector?

Asked

Viewed 115 times

0

I have this mistake:

ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied.

The normal correction is to define

session.gc_probability = 0

But in Centos, the correct thing is that the session.gc_probability be it 1. If anyone knows about, what can happen if I change to 0 on a Centos server?

But the main question is how to find out if there really is a CRON doing the job (which shouldn’t happen) and if anyone knows, how to disable this CRON.

1 answer

0

Some *Nix distributions, mainly those based on Debian, the directive session.gc_maxlifetime is ignored when set at runtime.

This is because such linux distributions disable the PHP setando garbage collector session.gc_probability=0.

To carry out garbage collection, the Operating System itself creates a CRONJOB, usually running every 30 minutes. This CRONJOB does the garbage collection task. To identify where and which sessions to clean, the CRONJOB script reads "php.ini". Specifically, they look for the directive session.gc_maxlifetime. The older ones look for session.gc_probability.

On the Internet, you will find many posts indicating session.gc_probability=0 as a solution to avoid the error described in the question. However, this does not work on newer systems. In the past the script looked for this directive however, the current ignore and search for session.gc_maxlifetime. So it is also common to see many users who say it doesn’t work disable with session.gc_probability=0.

For a more efficient solution, adjust the session.save_path to another location and disable the CRONJOB created automatically by the OS.

In this case, if the chosen filter does not have a regular cleaning, the trash will accumulate. You must create your own script and run it in CRONJOB or enable the PHP collector itself session.gc_probability=1.

To list the schedules of the user you are logged in with: crontab -l. Enter as root and run this command to see the schedules. Then just disable the specific schedule: https://stackoverflow.com/questions/14011065/enable-disable-tasks-in-crontab-by-bash-shell

But in Centos, the correct is that Session.gc_probability is 1. If someone knows about, what can happen if I change to 0 on a Centos server?

Not necessarily. You can set to zero. Then you must create your own collector, as explained above.

  • Thank you very much. Would you know if it is possible to disable CRON by Control Panel (Plesk)? Is there any way to check if the garbage collector is configured correctly by Plesk?

  • Plesk? I didn’t see mention Plesk in the question. Anyway, it is possible as long as you can log into Plesk as root. Just go into the Scheduled Tasks and you’ll see something like this: https://i.stack.Imgur.com/c5f8n.png That green ball underneath the S is where turn on or off.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.