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:

https://account.synology.com/support/support_form.php?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.
mahamoti
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

Postby 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

While
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?
yJan
I'm New!
I'm New!
Posts: 7
Joined: Sat Jun 21, 2014 11:54 am

PHP not sufficient rights

Postby yJan » Wed Dec 09, 2015 8:18 pm

Hello!

I have a similar question to this thread viewtopic.php?f=35&t=99806&p=376223&hilit=php+sudo#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. )

Return to “MySQL/PHP Mods”

Who is online

Users browsing this forum: No registered users and 1 guest