Edit report at http://bugs.php.net/bug.php?id=49401&edit=1
ID: 49401 Comment by: mabi at gentoo dot org Reported by: nathan at gossamer-threads dot com Summary: Semaphore files are being created in / by default Status: Bogus Type: Bug Package: Session related Operating System: Gentoo PHP Version: 5.2.10 New Comment: Gentoo's php-5.3 now uses the attached patch (thanks to tsisaru...@gmail.com) to automatically use the system's temp directory if no session save path is set. Imho, this is a useful default behaviour. Can you consider this patch for 5.3 or trunk? Previous Comments: ------------------------------------------------------------------------ [2009-08-31 16:40:28] nathan at gossamer-threads dot com Php 5.2.6 doesn't throw the error, but stracing does reveal that it's trying to create the file and failing: open("/session_mm_cgi-fcgi1009.sem", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) shmdt(0xb54c2000) = 0 shmctl(6619145, IPC_64|IPC_RMID, 0) = -1 EINVAL (Invalid argument) unlink("/session_mm_cgi-fcgi1009.sem") = -1 ENOENT (No such file or directory) If the expected behavior is to use the current working directory, this is not what it's doing: nat...@ndb3 ~ $ pwd /home/nathan nat...@ndb3 ~ $ php-cli -v PHP Warning: PHP Startup: mm_create(0, /session_mm_cli1005) failed, err mm:core: failed to open semaphore file (Permission denied) in Unknown on line 0 PHP 5.2.10 (cli) (built: Aug 28 2009 10:17:34) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies My assumption would be that the stock ini file that php ships with should contain a basic example that works on 99% of the machines out there. No reasonably configured machine would allow a user to write to /, so if there's no code change needed here perhaps the default php.ini should have that session.save_path uncommented? ------------------------------------------------------------------------ [2009-08-29 00:38:58] j...@php.net And I don't see any bug here anyway. If you don't define a path, it will just be "". And then it's up to whatever your current working directory happens to be. With Apache it's always /. ------------------------------------------------------------------------ [2009-08-29 00:36:07] j...@php.net Compared to what PHP version..? ------------------------------------------------------------------------ [2009-08-28 17:56:01] nathan at gossamer-threads dot com Description: ------------ As of 5.2.10 it seems that the semaphore files are being created in / instead of the usual /tmp. Uncommenting the default session.save_path of /tmp in the php.ini fixes it. Reproduce code: --------------- nat...@ndb3 ~ $ php --version PHP Warning: PHP Startup: mm_create(0, /session_mm_cgi-fcgi1005) failed, err mm:core: failed to open semaphore file (Permission denied) in Unknown on line 0 PHP 5.2.10 (cgi-fcgi) (built: Aug 28 2009 10:23:30) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=49401&edit=1