php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26186 include_path ignored using include with virtual path
Submitted: 2003-11-09 08:04 UTC Modified: 2003-11-09 18:49 UTC
From: jon at banton dot plus dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.4 OS: Windows 2000 Pro
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: jon at banton dot plus dot com
New email:
PHP Version: OS:

 

 [2003-11-09 08:04 UTC] jon at banton dot plus dot com
Description:
------------
I have just installed PHP 4.3.4 but I cannot get the "include" statement to work for virtual paths (those from the root).  I am running PHP with Apache 1.3.26 or 1.3.29 on Windows 2000 Pro.  The errors I get (2 for each include statement) are all like this:

[Sat Nov 08 20:24:35 2003] [error] PHP Warning:  main(/includes/dates/date_table.inc): failed to open stream: No such file or directory in c:\apache-web\info_site.phtml on line 54
[Sat Nov 08 20:24:35 2003] [error] PHP Warning:  main(): Failed opening '/includes/dates/date_table.inc' for inclusion (include_path='.;c:\apache-web') in c:\apache-web\info_site.phtml on line 54

Include statements work for relative paths, for full file paths and for HTTP URLs, but not for virtual paths.

They used to work: I have been using PHP Version 4.2.1 with Apache 1.3.26 successfully for some time.

To eliminate other factors, first I downloaded the latest version of Apache (I was using my existing version, which was 1.3.26).  But changing to 1.3.29 made no difference.

Then I tried installing a previous version of PHP - I tried 4.3.0, but this produces the same error.  In case I had done something in my original installation (4.2.1) that I had forgotten about, I downloaded a fresh copy of 4.2.1 and installed and ran that using exactly the same procedure as I used for 4.3.4 and 4.3.0.  Yes, that still worked, so the problem was in 4.3.0 and 4.3.4.

Other measures I have tried include (no pun intended):

changing the value of "include_path" from ".;c:\apache-web" to "c:\apache-web;."
changing the back slash to a forward slash (from ".;c:\apache-web" to "c:/apache-web;.")
changing the back slash to a double back slash (from ".;c:\apache-web" to ".;c:\\apache-web") [clutching at straws here]

In all cases, phpinfo() reported the correct value of "include_path"

Is this a known bug?  I have tried searching the reported bugs for PHP, but nothing showed up.  This does seem to be too fundamental to have escaped notice for (at least) four versions, though.

Reproduce code:
---------------
<?php include '/includes/check_browser.inc' ?>

Expected result:
----------------
File included (i.e. no entry in error.log)

Actual result:
--------------
Following entries in error.log:

[Sat Nov 08 16:33:20 2003] [error] PHP Warning:  main(/includes/check_browser.inc): failed to open stream: No such file or directory in c:\apache-web\info_site.phtml on line 9
[Sat Nov 08 16:33:20 2003] [error] PHP Warning:  main(): Failed opening '/includes/check_browser.inc' for inclusion (include_path='.;c:\apache-web') in c:\apache-web\info_site.phtml on line 9


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-09 08:28 UTC] wez@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

A / or \\ at the start of a filename is interpreted as an absolute path.

Please read the documentation carefully!
 [2003-11-09 18:49 UTC] jon at banton dot plus dot com
Thank you for your comment, but I have read the documentation carefully.  I know what the initial "/" or "\" means, but the correct term is virtual, as an absolute path includes scheme (e.g. http).  The fact is that the initial "\" indicates that the file should be located starting at the root, which is specified in the "include_path" statement.  As I said, in version 4.2.1 (and I have since checked 4.2.3) it works.  But in 4.3.0 it does not.  The only difference is the version of PHP, not my "include_path" setting, or any of my source files.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC