2014-04-15 51 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

相關問題