You are not logged in.

#1 2013-05-06 09:01:33

Registered: 2013-05-06
Posts: 1

Apache/php can't access to /tmp


I recently installed LAMP (following this documentation : on my desktop computer in order to do some testing on my local network.
It's been a while since I last used LAMP and I'm facing what seems to be a configuration issue.

After the install, I just edited a few lines of my configuration files :
- Uncommenting "" in php.ini
- Uncommenting "session.save_path = /tmp" in php.ini (this is important for the following)
- Adding "LoadModule php5_module modules/" to httpd.conf
- Adding "Include conf/extra/php5_module.conf" to httpd.conf

I created an index.php at my server's root (/srv/http) with just <?php phpinfo(); ?> in order to test LAMP.
Everything seemed to be OK since I got my php info when I went to http://localhost/

So I started to configure users, groups and permissions. Let's call my user "bob".
I added "bob" to the "http" group and I changed the ownership of /srv/http to "bob:http".
I copied an old personal project (php) in "/srv/http/myproject" and changed its permissions like the following (this project needs to be able to create, edit or delete files in some of its directories) :
- Files : 660
- Directories : 770

I can now access to http://localhost/myproject. Everything seems to work but the php sessions. I checked the apache error_log and got :

[warn] Init: Session Cache is not configured [hint: SSLSessionCache]
Warning: session_start() [function.session-start]: open(/tmp/sess_<random_session>, O_RDWR) failed: No such file or directory (2) in <myscript.php>

I commented the "mod_ssl" line in httpd.conf to get rid of the first warning (I'm on my local network so I guess I don't really need SSL).

Here's now my main issue : Apache / php can't write in /tmp (and I'd like to save my session files in this directory).

I created a php file at the server's root with "<?php touch("dummy.txt"); ?>. When executed, it creates a dummy.txt file in /srv/http/ => OK, the script is able to create a new file in its directory.
I then edited the php file : "<?php touch("/srv/http/dummy2.txt"); ?>. I got a dummy2.txt file beside dummy.txt => OK, so it's not a matter of absolute/relative path.
Last test : <?php touch("/tmp/dummy.txt"); ?>. I got nothing in /tmp/. It's like the script couldn't access to the /tmp directory.

I checked the permissions of /tmp/ : drwxrwxrwt => I don't understand why my apache / php can't create a file in /tmp/

I probably messed with my server configuration or permissions, but I can't explain this behaviour.
I hope someone will get my mistake because this really bothers me.

This post is quite long, sorry for that !
English is not my native language, so it's difficult for me to be accurate and concise at the same time wink

Thanks in advance,



Board footer

Powered by FluxBB