当出现错误时,如何使用shell_exec()从PHP中执行Linux实用程序;未找到命令";?
我安装了一个linux实用程序() 从命令行调用时,它可以正常工作,如:当出现错误时,如何使用shell_exec()从PHP中执行Linux实用程序;未找到命令";?,linux,shell,shell-exec,Linux,Shell,Shell Exec,我安装了一个linux实用程序() 从命令行调用时,它可以正常工作,如:$optipng image\u name.jpg 如果我试着像这样在PHP中执行它,shell_exec('optpng image_name.jpg')…我发现错误optipng命令未找到 当我尝试使用sudo从命令行运行命令时,也会出现错误sudo:optipng:command not found 安装此实用程序时,我使用了configure和make 要从shell_exec(),使其正常工作,我必须做些什么?问题
$optipng image\u name.jpg
如果我试着像这样在PHP中执行它,shell_exec('optpng image_name.jpg')代码>…我发现错误optipng命令未找到
当我尝试使用sudo
从命令行运行命令时,也会出现错误sudo:optipng:command not found
安装此实用程序时,我使用了configure
和make
要从shell_exec()
,使其正常工作,我必须做些什么?问题是由于无法识别PHP导致的,optpng的位置在哪里
您应该在linux控制台中尝试:-
whereis optipng
which optipng
一旦你有了绝对路径,
替换shell\u exec中的optpng