You are here: Re: How to execute two commands within 'system' « PHP Programming Language « IT news, forums, messages
Re: How to execute two commands within 'system'

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация