Issues with PHP 5.3 and Sessions Folder

Issues with PHP 5.3 and sessions folder

The fix: In your php.ini set session.gc_probability to 0

The cause
I believe I found the answer here http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage

Essentially, the garbage collection is set up to be done by cron jobs on some systems (i.e. Ubuntu/Debian). Some php ini executables like php-cli also try to do garbage collection and that results in the error you got.

PHP Session Storage / Update Issue

I came around a variety of different issues when trying to combine PHP's native $_SESSIONs with some of my project setups. The main issue was my attempt to try to combine PHP Sessions (stateful) with stateless approaches like REST. I finally concluded that in such cases, it's better to implement your own session handling using performant DB solutions like redis, or simply setup your own logic by adapting PHP's native session handling.

local php.ini sessions.save_path issue - sessions not recognised

You should place your session and upload directories outside of the document root otherwise these will be accessible by anyone and can result in remote script injection, session hijacking etc.

You should perhaps create a tmp directory as /home/aspac124/tmp and set the permissions so Apache can write to this directory. Perhaps set the chmod to 0760.

error when saving php sessions in project's directory

I was able to reproduce the same exact error, creating the session file but throwing "Session data file is not created by your uid.", but I am not sure if this is your case.

Anyway, my guess is that you are using an nfs server to keep your code, but you develop and run nginx locally. You made a nfs mount to the server directory to sync your code to the server(we had the same in one of my previous employments).

So you mount the nfs server directory to a local directory. What happens is that php creates your session file with user www-data, but this user has a different uid on the server than your local machine. So file is created, you see the correct owner, but its uid is different.

Check:

link

link

This is just my best guess. If this is it, let me know, maybe I could help with nfs user mapping. Hope it helps.



Related Topics



Leave a reply



Submit