php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77474 open_basedir set to "." prevents me from running PHP
Submitted: 2019-01-16 19:29 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: daniele dot testa at gmail dot com Assigned:
Status: Open Package: Safe Mode/open_basedir
PHP Version: 7.2.14 OS: Ubuntu 18.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: daniele dot testa at gmail dot com
New email:
PHP Version: OS:

 

 [2019-01-16 19:29 UTC] daniele dot testa at gmail dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-16 19:38 UTC] daniele dot testa at gmail dot com
Ok, so it seems it is working if I specify "./" as value, but that is not what the documentation says I should use.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Feb 23 00:01:25 2019 UTC