0

在我的 php 文件中,我正在尝试执行 shell 命令。我能够在终端中运行命令变量值就好了。但不知何故,shell_exec 并没有为我做这件事。

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

看起来“git status”甚至在这里都不起作用

$output = shell_exec('git status');

更新:终于报错了

sh:jpegoptim:找不到命令

4

1 回答 1

2

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

apt-get 安装 jpegoptim

于 2014-10-10T21:10:00.663 回答