Thread: php and exec
View Single Post
  #3  
Old 10-01-2012, 03:13 PM
mrxUx mrxUx is offline
Member
 
Join Date: Jul 2012
Posts: 23
Quote:
Originally Posted by mistwang View Post
You can set "PATH=...." in lsphp5 "Environment" configuration.
Not sure if the issue is there, let me go deeper and show you with a small php script I did to print stuff over LiteSpeed:

PHP Code:
<?php

// no big deal, it will just execute things and print them nice
out("echo \$PATH");
out("ls /usr/bin/which");
out("ls /usr/bin/convert");    
out("/usr/bin/which --version");
out("/usr/bin/convert --version");
out("/usr/bin/which convert");

function 
out($cmd) {
  
$out trim(`$cmd`);
  echo 
":: [$cmd]\n\t$out\n\n";
}
?>
This was the result:

Code:
:: [echo $PATH]
	/usr/local/bin:/bin:/usr/bin

:: [ls /usr/bin/which]
	/usr/bin/which

:: [ls /usr/bin/convert]
	/usr/bin/convert

:: [/usr/bin/which --version]
	GNU which v2.19, Copyright (C) 1999 - 2008 Carlo Wood.
GNU which comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.

:: [/usr/bin/convert --version]
	Version: ImageMagick 6.7.1-7 2012-09-15 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

:: [/usr/bin/which convert]
(***EMPTY***)
I hope this helps, as some Gallery scripts try to "autodetect" some binaries but the problem here is that "which" is not giving the right path.
Reply With Quote