2014-04-15 48 views
0

在我的php文件中,我试图执行一个shell命令。我能够在终端中运行命令变量值。但不知何故,shell_exec不会为我做。是否有可能在shell_exec php中运行jpegoptim命令?

$command = 'jpegoptim '.$imgpath; 
shell_exec($command); 

看起来像 'git的状态' 甚至不会在这里工作

$output = shell_exec('git status'); 

更新:终于得到一个错误

SH:jpegoptim:找不到

回答

1

你可以使用命令在您的服务器上安装jpegoptim。在此之后,您可以使用shell_exec(“jpegoptim”)命令。

apt-get install jpegoptim

相关问题