Bug #77474 [Opn->Dup]: open_basedir set to "." prevents me from running PHP

From: Date: Mon, 03 May 2021 12:15:42 +0000
Subject: Bug #77474 [Opn->Dup]: open_basedir set to "." prevents me from running PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233656@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77474&edit=1 ID: 77474 Updated by: cmb@php.net Reported by: daniele dot testa at gmail dot com Summary: open_basedir set to "." prevents me from running PHP -Status: Open +Status: Duplicate Type: Bug Package: Safe Mode/open_basedir Operating System: Ubuntu 18.04 PHP Version: 7.2.14 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Duplicate of bug #46925. Previous Comments: ------------------------------------------------------------------------ [2019-01-16 19:38:26] 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. ------------------------------------------------------------------------ [2019-01-16 19:29:11] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77474&edit=1

« previous php.bugs (#233656) next »