| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2002-01-04 00:22 UTC] php at chaska dot com
  [2002-01-04 00:47 UTC] imajes@php.net
  [2002-01-04 05:01 UTC] edink@php.net
  [2002-01-04 05:02 UTC] edink@php.net
  [2002-01-04 11:59 UTC] php at chaska dot com
  [2002-01-04 13:10 UTC] mfischer@php.net
  [2002-06-10 19:04 UTC] mfischer@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 08:00:01 2025 UTC | 
This problem was previously reported by someone against PHP 4.0.6 in Bug ID # 14214. Latest comment on the that reports says they are going to close it for lack of information. This bug has existed in every version of PHP I've used since 1999. It fails on Linux, FreeBSD and Solaris. Both mistaken report the directory which contains the script being run, NOT the current working directory. This fails when run from a directory other than where the script is saved: #! /usr/local/bin/php -q <?php system("pwd"); echo `pwd`; echo getcwd(); echo "\n"; ?> Under any POSIX-compliant OS, or just about any version of Unix, calling the getcwd(3) library routine should get the correct result. It appears the PHP interpreter startup is changing directories without saving this value first, since even calling the OS gives incorrect values.