Bug #77474 [NEW]: open_basedir set to "." prevents me from running PHP
| From: | daniele dot testa at gmail dot com | Date: | Wed, 16 Jan 2019 19:29:11 +0000 |
| Subject: | Bug #77474 [NEW]: open_basedir set to "." prevents me from running PHP | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219020@lists.php.net to get a copy of this message | ||
From: daniele dot testa at gmail dot com
Operating system: Ubuntu 18.04
PHP version: 7.2.14
Package: Safe Mode/open_basedir
Bug Type: Bug
Bug description:open_basedir set to "." prevents me from running PHP
Description:
------------
php.ini set to:
open_basedir = .
Nginx config:
location / {
root /opt/www/test;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/www/test/index.php;
include fastcgi_params;
}
From documentation:
The special value . indicates that the working directory of the script
will be used as the base-directory.
Trying to GET the PHP-file results in:
2019/01/16 19:06:39 [error] 3013#3013: *9 FastCGI sent in stderr: "PHP
message: PHP Warning: Unknown: open_basedir restriction in effect.
File(/opt/www/test/index.php) is not within the allowed path(s): (.) in
Unknown on line 0
Expected result:
----------------
I expect the file to be executed and result sent to client. According to
documentation, setting open_basedir to "." should limit the current
script to the current directory, but it does not even seem to allow the
ACTUAL script to run at all.
If I turn off open_basedir and just print the getcwd(), I can clearly
see that current dir is /opt/www/test and as the "." setting should
allow access to "current dir", it should allow the execution of
/opt/www/test/index.php, but it does not.
Actual result:
--------------
2019/01/16 19:06:39 [error] 3013#3013: *9 FastCGI sent in stderr: "PHP
message: PHP Warning: Unknown: open_basedir restriction in effect.
File(/opt/www/test/index.php) is not within the allowed path(s): (.) in
Unknown on line 0
--
Edit bug report at https://bugs.php.net/bug.php?id=77474&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77474&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77474&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77474&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77474&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77474&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77474&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77474&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77474&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77474&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77474&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77474&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77474&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77474&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77474&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77474&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77474&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77474&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77474&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77474&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77474&r=mysqlcfg