|
Posted by d on 02/14/06 19:30
<francescomoi@usa.com> wrote in message
news:1139935640.768005.71940@g47g2000cwa.googlegroups.com...
> Hi.
>
> On PHP4, I want to execute these two system commands:
> # cd /home/foo1/foo2
> # /usr/local/php/bin/php /home/foo1/foo2/script.php
>
> If I do it via shell, it works ok.
>
> But If I do:
> -------
> system("cd /home/foo1/foo2/", $retval);
> system("/usr/local/php/bin/php /home/foo1/foo2/script.php", $retval);
> --------
>
> I get this error message:
> -----
> Fatal error: main(): Failed opening required '../config/config.php'
> (include_path='.:/usr/local/php/lib/php') in /home/foo1/foo2/script.php
> on line 2
> -----
>
> This error is caused by the fact that the script is not executed in the
> right directory.
>
> Any similar experience?
Why don't you use the chdir function instead of system()ing a "cd"?
dave
Navigation:
[Reply to this message]
|