cd vs. chdir()
| From: | Ron Rudman | Date: | Sun, 04 May 2003 21:50:56 +0000 |
| Subject: | cd vs. chdir() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146380@lists.php.net to get a copy of this message | ||
From a php file, is it not possible to change the working directory using a
cd, or is it required to use the php function chdir()? Here is my test:
<?php
echo "test 1\n";
echo pwd;
cd /var/log;
echo pwd;
echo "test 2\n";
system("pwd");
system("cd /var/log");
system("pwd");
echo "test 3\n";
echo getcwd()."\n";
chdir("/var/log");
echo getcwd()."\n";
system("pwd");
?>
and here is the output:
test 1
/usr/hh/bin
/usr/hh/bin
test 2
/usr/hh/bin
/usr/hh/bin
test 3
/usr/hh/bin
/var/log
/var/log