|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-06-18 00:17 UTC] edink@php.net
[2013-10-28 10:55 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
-Package: Feature/Change Request
+Package: *General Issues
-Assigned To:
+Assigned To: krakjoe
[2013-10-28 10:55 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 15:00:01 2025 UTC |
Description: ------------ When keeping include files separate from publicly accessible documents, paths to access files in the includes directory can differ for different pages in the site. For example, on my setup I keep my site in /var/www; publicly-accessible pages (including my PHP pages) are in /var/www/pub (which is Apache's ServerRoot), and the include file is in /var/www/inc. Also stored in /var/www/inc are ini files my PHP application uses. /var/www/inc is in my include_path. In my PHP pages, I use require('include.inc'). Inside include.inc there are calls to parse_ini_file() to process my ini files. Since my ini files are stored in the same directory as my include file, I figured at first that referencing them as simple 'config.ini' etc. would work. Unfortunately, it doesn't, as it looks in the directory of the currently-executing script. Wouldn't it be more logical for parse_ini_file() to look in include_path instead, considering 1) almost any sane include_path includes ./ anyway, and 2) common sense dictates that ini files should be kept out of the ServerRoot, and it makes sense to put them with the other files that should be kept out of the ServerRoot, your include files? Reproduce code: --------------- File: ServerRoot/pub/test.php ============================= <?php include('include.inc'); ?> File: ServerRoot/inc/include.inc ================================ <?php $ini = parse_ini_file('config.ini'); echo $ini['value']; ?> File: ServerRoot/inc/config.ini =============================== value=hi Expected result: ---------------- hi Actual result: -------------- Warning: parse_ini_file(): Cannot open 'config.ini' for reading in ServerRoot/include.inc on line 1