php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30416 include / include_once relative paths on command line
Submitted: 2004-10-13 00:25 UTC Modified: 2004-10-13 01:13 UTC
From: Severn at dreamfusion dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.2 OS: Linux
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: Severn at dreamfusion dot net
New email:
PHP Version: OS:

 

 [2004-10-13 00:25 UTC] Severn at dreamfusion dot net
Description:
------------
May be related to bug #29949, #28338, #9673

When using the php cli, relative paths are not relative to the script, but relative to where the cli was started

Notes:
-No include_path is set in php.ini
-Works as expected in PHP 4.3.8 (cgi)
-Works as expected when PHP is an Apache module

Reproduce code:
---------------
/inc/a.php
<?php include('../b.php'); ?>

/b.php
<?php echo 'boo'; ?>

cd /
php inc/a.php

Expected result:
----------------
boo

Actual result:
--------------
PHP Warning:  main(../b.php): failed to open stream: No such file or directory in /inc/a.php on line 1
PHP Warning: main(): Failed opening '../b.php' for inclusion (include_path='.:/usr/lib/php') in /inc/a.php on line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-13 01:13 UTC] johannes@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

PHP CLI doesn\'t change it\'s working directory like other 
sapis. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Nov 21 22:00:01 2025 UTC