Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fc7antu's avatar

shell_exec() is not working for specific command

I have installed CALIBRE . Calibre convert files from pdf to epub. in terminal when i run /opt/calibre/ebook-convert it started and working perfectly.

but when i run same command in my shell_exec() it is not working. But other command in shell_exec is working and running fine.

0 likes
2 replies
Tray2's avatar

To troubleshoot this I would store the command in a variable

Something like

$command = 'ffmpeg -loglevel quiet -stats -i ' . $filename . ' -vf scale=1280:720 ' -o . $filename . '-720p.' . $extension;

echo command;

Then I would copy paste it and try running it.

It most likely has to do with whitespace in the file name. Try replacing ' ' with '\ '.

Please or to participate in this conversation.