PHP exec or shell_exec the convert command from ImageMagick

Questions regaring MySQL and PHP may go here
Forum rules
1) This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form: ... p?lang=enu

2) To avoid putting users' DiskStation at risk, please don't paste links to any patches provided by our Support team as we will systematically remove them. Our Support team will provide the correct patch for your DiskStation model.
I'm New!
I'm New!
Posts: 3
Joined: Thu Apr 23, 2015 10:49 am

PHP exec or shell_exec the convert command from ImageMagick

Unread post by mahamoti » Thu Apr 23, 2015 10:56 am

Hi tweakers,

I'm strubling some days with configuring PHP to exec /usr/bin/convert.
Things i tried:
$exec = exec('/usr/bin/convert 1.pdf 1.jpg', $output, $return);

I installed sudo and give http sudo rights
$exec = exec('sudo convert 1.pdf 1.jpg', $output, $return);
But it doens't work either

exec('ls -l');
Works succesfully

The webserver runs as user "http"
I tried to chmod 777 /usr/bin/convert

somebody a idea?
Or a way to install imagemagick so it will work in PHP?

I'm New!
I'm New!
Posts: 7
Joined: Sat Jun 21, 2014 11:54 am

PHP not sufficient rights

Unread post by yJan » Wed Dec 09, 2015 8:18 pm


I have a similar question to this thread ... do#p376223.

Can anyone give help me, I had found a viable solution ( cant find it anymore ) on google that was about exactly the same problem and it was solved with coding a file in C and setting the suid bit.
My next approach was to try it with sudo.
I have tried that, and it didn't work.

I want the php Process to write a file ( setting the owner and gid of a file to http didnt help ) or execute a command that does that. But all my attempts have failed so far.

Please help me. :shock:

( this message has been attached to an outdated thread, so I'm posting this again. Please don't move it, or at least message me why you had to do. )

Post Reply

Return to “MySQL/PHP Mods”