php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12444 require_once doesn't support relative paths completely
Submitted: 2001-07-28 01:05 UTC Modified: 2001-10-02 04:21 UTC
From: willwong at samurai dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: FreeBSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: willwong at samurai dot com
New email:
PHP Version: OS:

 

 [2001-07-28 01:05 UTC] willwong at samurai dot com
I was unable to alter the previous report because I had not entered a password when I reported the bug...

It appears to work in simple cases:

ie when:
/php/test.php
/common.php

in test.php
<?
   require_once('../common.php');
   display_test();
?>

in common.php
<?
   function display_test()
   {   
      echo 'test';
   }
?>

But it fails in the following case:
/usr/home/willwong/public_html/common.php
/usr/home/willwong/public_html/php/common2.php
/usr/home/willwong/public_html/php/php2/test.php

in test.php
<?
   require_once('../../common.php');
   display_test();
?>

in common.php
<?
   require_once('php/common2.php');
?>

in common2.php
<?
   function display_test()
   {   
      echo 'test';
   }
?>

This fails with the error:
Fatal error: Failed opening required 'php/common2.php' (include_path='') in /usr/home/willwong/public_html/common.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-31 21:59 UTC] sniper@php.net
Could you please try the latest CVS snapshot from 
http://snaps.php.net since some changes to this were made.

--Jani

 [2001-10-02 04:21 UTC] sander@php.net
No feedback... closing
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 22:01:27 2025 UTC