system, exec, shell_exec, passthru [RESOLVED]

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

 



Hello,

This problem has now been resolved.
The problem as described below was NOT caused by
PHP. The problem was actually a file permissions/ownership problem.

A.) The apache webserver runs as a user with specific
priviledges. On this particular server the webserver runs as user
'apache'.

B.) The file that CGI/PHP 'myprog' was attempting to open for input
was owned by a different user. The user 'apache' had no rights to 
the file.

C.) Because the CGI was unable to open the input file, several
following output files failed to be generated. Thus the error in PHP.

The resolution was to place files, to be accessed by the apache webserver
user, in directories and files that are owned by apache:apache, or 
nobody:nogroup.

chown apache:apache /mydirectory
cd mydirectory
chown apache:apache -R *

[or]

chown nobody:nogroup /mydirectory
cd mydirectory
chown nobody:nogroup -R *

I hope this helps people with similar problems in the future.

All the best,

Peter


>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


[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