note 118942 added to ini.core

From: Date: Thu, 03 Mar 2016 17:11:56 +0000
Subject: note 118942 added to ini.core
Groups: php.notes 
Request: Send a blank email to php-notes+get-205091@lists.php.net to get a copy of this message
It appears that if you use both the 'include_path' directives and 'open_basedir', that file searches will hit the include path *first*, before local files. But if 'open_basedir' is not in use, then local files are found first. For example, suppose you have code in '/var/www/myfile.php' which does: <?php require_once('config.php'); ?> Further, assume that there is a local file '/var/www/config.php', and there is also a file '/var/local/php/config.php'. Next, if your php.ini has: include_path = /var/local/php/ Normally, this would look for '/var/www/config.php' first, and if not found, then it would try '/var/local/php/config.php'. But if you also have this in php.ini: open_basedir = /var/www/:/var/local/php/ Then the require would reverse the order of the search, and load '/var/local/php/config.php', even when the local 'config.php' file exists. Furthermore, if include_path contains directories not in open_basedir, you can end up with a fatal error. For example, change the directive to: open_basedir = /var/www/:/var/local/includes/php/ Now the require will first find '/var/local/php/config.php' from the include_path, try to include it, but be unable to because of the open_basedir restrictions. ---- Server IP: 72.52.91.14 Probable Submitter: 98.251.116.220 ---- Manual Page -- http://php.net/manual/en/ini.core.php Edit -- https://master.php.net/note/edit/118942 Del: integrated -- https://master.php.net/note/delete/118942/integrated Del: useless -- https://master.php.net/note/delete/118942/useless Del: bad code -- https://master.php.net/note/delete/118942/bad+code Del: spam -- https://master.php.net/note/delete/118942/spam Del: non-english -- https://master.php.net/note/delete/118942/non-english Del: in docs -- https://master.php.net/note/delete/118942/in+docs Del: other reasons-- https://master.php.net/note/delete/118942 Reject -- https://master.php.net/note/reject/118942 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205091) next »