简体   繁体   English

php exec无法通过脚本运行,但可通过命令行运行

[英]php exec not working from script but working from command line

I try to execute command 我尝试执行命令

convert -geometry x30 C:\xampp\htdocs\schuleweise\engine\Shopware\../../media/image\3573349700001A.jpg C:\xampp\htdocs\schuleweise\engine\Shopware\../../media/image\thumbnail\3573349700001A_30x30.jpg

Which works from command line, but not from the script with exec($command). 它可以从命令行运行,但不能从具有exec($ command)的脚本运行。 can anybody help me here ? 有人可以帮我吗?

exec() commands require full path to command in order to work in php. exec()命令需要完整的命令路径才能在php中工作。

Try it like this, 这样尝试

exec('usr/bin/convert -geometry x30 ..', $output);

Try to alternate function to exec() 尝试将函数替换为exec()

system($shell_command, $response_var);

So in your case: 因此,在您的情况下:

system("convert -geometry x30 C:\xampp\htdocs\schuleweise\engine\Shopware\../../media/image\3573349700001A.jpg C:\xampp\htdocs\schuleweise\engine\Shopware\../../media/image\thumbnail\3573349700001A_30x30.jpg", $output);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM