hi,
i am trying to do a simple check for archiving utilities (zip, unzip,
...), to make sure they exist within the PATH, and are executable by
PHP.
i could not find a better way to do this through php, so i went ahead
and did an
exec('which ' . $utility, $output, $return_value);
then, i check the $return_value for a non-zero value, which would
indicate that the utility was not found. using GNU/Linux this seems to
work fine, but i wouldn't mind keeping my work cross-platform.
so, my question is, is there a better way to do this?
and, if not, what i have done, for now is the following:
$result = exec('which ' . $utility, $output, $return_val);
return( $result && !$return_val );
from one quick test i ran, i determined that exec() simply returns NULL
or nothing if the given utility/command doesn't exist (`which`, in this
case).
so, i expect the above code to simply return true, or skip the test for
my $utility rather, if the `which` utility is not present on the system.
will this work as expected in all cases/systems?
thanks a lot.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php