php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14214 getcwd() and `pwd` return wrong directory
Submitted: 2001-11-24 18:47 UTC Modified: 2002-01-07 05:35 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ASkwar at DigitalProjects dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.6 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: ASkwar at DigitalProjects dot com
New email:
PHP Version: OS:

 

 [2001-11-24 18:47 UTC] ASkwar at DigitalProjects dot com
I've written a small shell script in PHP, which should return the current working directory:

-----
#!/usr/bin/php -q
<?php
echo `pwd`;
echo getcwd();
?>
-----

I've stored the script as /scripts/test.php and on the shell, I'm in /scripts/Testing.  When I run the script with ?../test.php?, it returns ?/scripts? two times.  I'd expect it to return ?/scripts/Testing? two times.

However, HTTP_ENV_VARS['PWD'] and HTTP_SERVER_VARS['PWD'] both contain the correct (ie. /scripts/Testing) path.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-26 02:44 UTC] derick@php.net
What is your configure line?

Derick
 [2001-12-17 07:14 UTC] sander@php.net
No feedback. Closing.
 [2002-01-07 02:22 UTC] lobbin@php.net
Closed it should be.
 [2002-01-07 05:35 UTC] edink@php.net
For a descrioption of a problem and a solution
plaese see: http://bugs.php.net/bug.php?id=14839
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 19:01:37 2025 UTC