【问题标题】:Is it possible to run jpegoptim command in shell_exec php?是否可以在 shell_exec php 中运行 jpegoptim 命令?
【发布时间】:2014-05-30 09:24:35
【问题描述】:

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

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

看起来 'git status' 在这里甚至不起作用

$output = shell_exec('git status');

更新:终于报错了

sh: jpegoptim: 找不到命令

【问题讨论】:

    标签: php shell terminal image-optimization


    【解决方案1】:

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

    apt-get 安装 jpegoptim

    【讨论】:

      猜你喜欢
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-28
      • 1970-01-01
      • 2017-02-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多