Bug #74689 [Opn->Fbk]: .user.ini still effective even outside DOCUMENT_ROOT

From: Date: Mon, 21 Sep 2020 17:06:17 +0000
Subject: Bug #74689 [Opn->Fbk]: .user.ini still effective even outside DOCUMENT_ROOT
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229115@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74689&edit=1 ID: 74689 Updated by: cmb@php.net Reported by: lsljohn2002 at gmail dot com Summary: .user.ini still effective even outside DOCUMENT_ROOT -Status: Open +Status: Feedback Type: Bug Package: CGI/CLI related Operating System: alpine PHP Version: 7.0.19 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Could you please provide a request URI, and the respective values of - $_SERVER['DOCUMENT_ROOT'] - $_SERVER['PATH_TRANSLATED'] - $_SERVER['SCRIPT_FILENAME'] Previous Comments: ------------------------------------------------------------------------ [2017-09-13 15:11:12] pascal dot christen at hostpoint dot ch We're facing the same issue starting with PHP >7 (it's wokring on PHP56) on FreeBSD. Do you have any solution for this? ------------------------------------------------------------------------ [2017-06-01 21:41:14] lsljohn2002 at gmail dot com Description: ------------ My server is hosting some sites and I have some site specific settings for each site, so I put a .user.ini file under each site's document root directory. According to PHP documentation: In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). However, to my surprise, even if I placed the .user.ini file outside of a site's document_root, it's still working, as long as it's within the path of the script. For example, if I'm running a script https://A_DOMAIN_com/foo/bar/abc.php, and in the server its real path is /www/public_html/A_DOMAIN_com/foo/bar/abc.php, where the $_SERVER['DOCUMENT_ROOT'] has been set to /www/public_html/A_DOMAIN_com/. Then even if I place the .user.ini file inside any of its path, e.g. /www/public_html/A_DOMAIN_com/, or /www/public_html/, or even /www/, the .user.ini file is still effective. Is this a bug or expected behaivor? I'm running PHP 7.0.15, the script is triggered by php-cgi7, the os is alpine. I guess this bug is caused somewhere between line 851 to line 900 of cgi_main.c ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74689&edit=1

« previous php.bugs (#229115) next »