PHP5 session data


#1

You have an article where you explain how to move the sessions to tmpfs so I thought I’d ask you for help even though I haven’t moved them.

my sessions are still stored in here and apparently owned by root:

ls -al /var/lib/php5/  
total 5040  
drwx-wx-wt  2 root root 5144576 Jun  3 13:20 .  
drwxr-xr-x 76 root root    4096 May 21 22:42 ..  
-rw-------  1 root root       0 Jun  3 13:20 sess_26qvcar4iiars91a26050s9kv2

The above was generated after I logged into a webmail on my server but it was created with root as owner/group - does this seem right to you? Shouldn’t it be the user/group php5-fpm runs as?

How can I check whether my cron job that is supposed to clean my sessions runs correctly? I found it inside /etc/cron.d/php5

(2:1838)# cat /etc/cron.d/php5  
# /etc/cron.d/php5: crontab fragment for php5  
#  This purges session files older than X, where X is defined in seconds  
#  as the largest value of session.gc_maxlifetime from all your php.ini  
#  files, or 24 minutes if not defined.  See /usr/lib/php5/maxlifetime  

# Look for and purge old sessions every 30 minutes  
09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -x /usr/lib/php5/sessionclean ] && [ -d /var/lib/php5/sessions ] && /usr/lib/php5/sessionclean /var/lib/php5/sessions $(/usr/lib/php5/maxlifetime)

#2

@ovidiu,
You don’t performed search and replace of Cron Jobs,

Edit cron on Debian/Ubuntu vim /etc/cron.d/php5 Find 2 occurrences of /var/lib/php5/ and replace them with /var/run/php5/sessions/

#3

No, no, I haven’t followed your tutorial. My PHP5 is still default. I was just wondering why my sessions are created owned by root and not www-data as indicated in your tutorial… any idea?

As I said above:

You have an article where you explain how to move the sessions to tmpfs so I thought I’d ask you for help even though I haven’t moved them.

#4

@ovidiu,

my sessions are created owned by root and not www-data

That is absolutely fine. In Debian, by default, /var/lib/php5 folder is owned by root, with permission drwx-wx-wt,
This link will surely help you:


#5

thx!


#6