简体   繁体   中英

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). can anybody help me here ?

exec() commands require full path to command in order to work in php.

Try it like this,

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

Try to alternate function to 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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