Bug #69658 [Opn->Fbk]: session.save_path PHP_ADMIN_VALUE fastcgi_param Mode Not Parsed Correctly
| From: | yohgaki@php.net | Date: | Tue, 19 May 2015 10:31:47 +0000 |
| Subject: | Bug #69658 [Opn->Fbk]: session.save_path PHP_ADMIN_VALUE fastcgi_param Mode Not Parsed Correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192751@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69658&edit=1
ID: 69658
Updated by: yohgaki@php.net
Reported by: own3mall at gmail dot com
Summary: session.save_path PHP_ADMIN_VALUE fastcgi_param Mode
Not Parsed Correctly
-Status: Open
+Status: Feedback
Type: Bug
Package: FPM related
Operating System: Ubutun 15.04
PHP Version: 5.6.9
Block user comment: N
Private report: N
New Comment:
I'm not familiar with the applicable code, but
session.save_path=0;660;/var/www/php_sessions";
you have ";" which indicates start of comment.
Something like
session.save_path=\"0;660;/var/www/php_sessions\"";
may work. Refer to Nginx manual for correct syntax.
Previous Comments:
------------------------------------------------------------------------
[2015-05-19 04:10:21] own3mall at gmail dot com
Description:
------------
If I setup a server entry in nginx which has the following section
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/new$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE
"open_basedir=/var/www/new/:/tmp:/usr/share/php:/usr/share/pear:/usr/share/roundcube \n
upload_tmp_dir=/tmp \n session.save_path=0;660;/var/www/php_sessions";
include fastcgi_params;
}
session.save_path is not parsed correctly. When using session_save_path(), the path is set to
"0". For some reason, in nginx configuration files, the MODE set in PHP_ADMIN_VALUE for
session.save_path is not processed correctly. I would expect session_save_path() to return
"/var/www/php_sessions" as it does in Apache when using this:
php_admin_value session.save_path 0;660;/var/www/php_sessions
It should not return "0" as the path. It took me days to figure out why this wasn't
working in nginx when it was working in apache.
Similar to bug #52609. Problem is still occurring in php5-fpm package from Ubuntu 15.04. Actual
true version is:
PHP 5.6.4-4ubuntu6 (fpm-fcgi) (built: Apr 17 2015 15:47:47)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
Test script:
---------------
Setup and install nginx and php5-fpm. In /etc/nginx/sites-enabled/default, add this:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/new$fastcgi_script_name;
fastcgi_param PHP_ADMIN_VALUE
"open_basedir=/var/www/new/:/tmp:/usr/share/php:/usr/share/pear:/usr/share/roundcube \n
upload_tmp_dir=/tmp \n session.save_path=0;660;/var/www/php_sessions";
include fastcgi_params;
}
Put a php file in the root with the following:
<?php
session_start();
echo "My session path is: " . session_save_path();
?>
Expected result:
----------------
When specified with a preceding MODE, the file permissions mode should be respected, and the
session.save_path should return as defined "/var/www/php_sessions" rather than
"0"
Actual result:
--------------
session.save_path is "0".
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69658&edit=1