Re: system, exec, shell_exec, passthru

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use exec() instead of system() and pass in args for output and error
number and then you'll get an error number telling you what went
wrong.

You'll have to look up the error number in a shell with 'perror' (man
perror) unless you dig my modest extension to do it from PHP:
http://l-i-e.com/perror

On Mon, August 14, 2006 10:23 am, p.willis@xxxxxxxxx wrote:
> Hello,
>
> I am trying the run an external application with
> command line arguments using PHP under linux.
>
> ie:
>
> $command="myprog $arg1 $arg2 > textfile.txt";
> system("echo \"$command\" > test.txt");
> system($command);
>
> $handle=fopen("textfile.txt","r");
> if($handle!=NULL)
> {
> 	while(!feof($handle))
> 	{
> 		...
> 	}
> 	fclose($handle);
> }
>
>
> I test my input arguments for the 'system' call by dumping
> the command into a text file. I can then test the command in
> the console. The commands work fine when run from the console.
>
> The commands don't work when run through the system command.
> I have tried system, exec, passthru, and shell_exec to no avail.
>
> Am I missing some permissions thing in my php.ini file?
>
> Thanks for any insight,
>
> Peter
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux