NYCPHP Meetup

NYPHP.org

[nycphp-talk] What does PHP use to find programs that are exec'ed?

Jayesh Sheth jay_nyphp at fastmail.fm
Thu Jun 23 09:34:39 EDT 2005


Hello Francisco,

Thanks for your help.
I did try using the full path, but it did not work. It's really weird. I
thought it was a permissions or ownership issue, but the other PHP
binary which did work had 'root' as its user and 'staff' as their group,
and both had permissions of -rwxr-xr-x .

For example:
jay:/usr/bin# ls -l /usr/bin/php5_0 /usr/local/bin/php
-rwxr-xr-x  1 root staff 17327872 2005-06-22 15:52 /usr/bin/php5_0
-rwxr-xr-x  1 root staff  8492541 2005-05-24 16:38 /usr/local/bin/php

The code I used to run the exec with the full path was:

<?php
$output = '';
$exec = '';
exec('/usr/bin/php5_0 --help', $output, $exec);
if ($exec)
{
	echo 'Yes';
}
else
{
	echo 'No';
}
print_r($output);
?>

>From the shell (bash), if I do /usr/bin/php5_0 --help it outputs stuff.

I am running Debian Linux - I am not sure if a Debian quirk is at work
here (but somehow I doubt it).
Shouldn't exec() be able to run any executable on the system with a full
path, or are there some other requirements for that executable?

Maybe I am doing something dumb here, or just missing something. 

Thanks,

- Jay



More information about the talk mailing list