note 49423 added to function.getcwd
| From: | vermicin at antispam dot gmail dot com | Date: | Thu, 27 Jan 2005 11:48:50 +0000 |
| Subject: | note 49423 added to function.getcwd | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84072@lists.php.net to get a copy of this message | ||
If your PHP cli binary is built as a cgi binary (check with php_sapi_name), the cwd functions
differently than you might expect.
say you have a script /usr/local/bin/purge
you are in /home/username
php CLI: getcwd() gives you /home/username
php CGI: getcwd() gives you /usr/local/bin
This can trip you up if you're writing command line scripts with php. You can override the CGI
behavior by adding -C to the php call:
#!/usr/local/bin/php -Cq
and then getcwd() behaves as it does in the CLI-compiled version.
----
Manual Page -- http://www.php.net/manual/en/function.getcwd.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49423
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49423&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49423&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49423&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49423&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49423&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49423&report=yes
Search -- http://master.php.net/manage/user-notes.php