note 95705 added to function.chdir
| From: | CsongorHalmai at osu1 dot php dot net | Date: | Sun, 17 Jan 2010 03:56:54 +0000 |
| Subject: | note 95705 added to function.chdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165042@lists.php.net to get a copy of this message | ||
Sorry but the previous note from php dot duke at qik dot nl is a bit confusing and not exact enough
I think so I redefine the symptom.
Take a look at the following code:
<?php
var_dump( getcwd() );
chdir( "./" ); // this eliminates the anomaly
var_dump( getcwd() );
?>
Under windows XP if I open a command prompt by Start -> Run -> cmd.exe and launch the script
by the following command:
php "c:\my_code.php"
then the output will be the following:
string(40) "C:\Documents and Settings\<username>"
string(40) "C:\Documents and Settings\<username>"
There is no surprise.
But if I open a command prompt from Total Commander by Command => DOS command menu when I stand
in the C:\ directory and after this I issue the eariler command:
php "c:\my_code.php"
then I get the following result:
string(3) "c:\"
string(3) "C:\"
Shortly: Total commander launches my php script with small drive letter while cmd.exe does with
capital drive letter. This ambiguity can be eliminated by a chdir( "./" ) function call.
----
Server IP: 92.43.200.200
Probable Submitter: 62.201.96.66
----
Manual Page -- http://www.php.net/manual/en/function.chdir.php
Edit -- https://master.php.net/note/edit/95705
Del: integrated -- https://master.php.net/note/delete/95705/integrated
Del: useless -- https://master.php.net/note/delete/95705/useless
Del: bad code -- https://master.php.net/note/delete/95705/bad+code
Del: spam -- https://master.php.net/note/delete/95705/spam
Del: non-english -- https://master.php.net/note/delete/95705/non-english
Del: in docs -- https://master.php.net/note/delete/95705/in+docs
Del: other reasons-- https://master.php.net/note/delete/95705
Reject -- https://master.php.net/note/reject/95705
Search -- https://master.php.net/manage/user-notes.php