Working on SSH but not on PHP

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
carlosgoce
Posts: 9
Joined: 2012-04-25T07:37:26-07:00
Authentication code: 13

Working on SSH but not on PHP

Post by carlosgoce »

Hi, a few weeks ago i posted my problem and finally i got the solution. Or that is what i thought. The problem is still there.

When i use this via SSH
"/kunden/homepages/39/d296597816/htdocs/imagick6.7/bin/convert input.jpg -scale 600x300 -background white -gravity center -extent 600x300 output.jpg"
it works 100% perfect.

When i use this via PHP
exec("/kunden/homepages/39/d296597816/htdocs/imagick6.7/bin/convert input.jpg -scale 600x300 -background white -gravity center -extent 600x300 output.jpg");
(the same as above)
This don't work.

I tried everything and still have no idea what's the problem. Any idea?
How can capture a "text error" on the PHP exec?

Things like
exec("$pathTo/convert input.jpg -scale $width output.jpg");
works perfect on both sides.

Maybe there is another way to do the command posted above?
I tried with:
exec("/kunden/homepages/39/d296597816/htdocs/imagick6.7/bin/convert imagenPruebas.jpg -fill white -scale 600x600^ output.jpg");
But it doesnt fill the white space.

Sorry for my English.

Finally i manage to catch the error. I get the following error:
libgomp: Thread creation failed: Resource temporarily unavailable
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Working on SSH but not on PHP

Post by fmw42 »

I am not an expert on this, but perhaps php is using a different/older version of libgomp or perhaps does not have it built. I would check with your ISP. Why is it temporarily unavailable? Perhaps you server is overloaded?

But I will defer to the IM developers on this.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Working on SSH but not on PHP

Post by Bonzo »

You can use this method to display errors although the error is sometime not what it seems:

Code: Select all

echo "<pre>";
exec("/kunden/homepages/39/d296597816/htdocs/imagick6.7/bin/convert input.jpg -scale 600x300 -background white -gravity center -extent 600x300 output.jpg 2>&1", $array); 
echo "<br>".print_r($array)."<br>";
echo "</pre>";
carlosgoce
Posts: 9
Joined: 2012-04-25T07:37:26-07:00
Authentication code: 13

Re: Working on SSH but not on PHP

Post by carlosgoce »

I dont know if this have any sense but i fixed it (it seems to be) installing imagemagick with ./configure --without-threads and then make && make install

And now its working.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Working on SSH but not on PHP

Post by fmw42 »

carlosgoce wrote:I dont know if this have any sense but i fixed it (it seems to be) installing imagemagick with ./configure --without-threads and then make && make install

And now its working.
Yes sometimes different systems do not work well with OpenMP. So disabling OpenMP or turning off threads (setting threads to 1) can help.

Glad you were able to solve it. This is the first time I have seen that problem with threading using PHP. I am not sure if it is really related to PHP or just to what machine you are running IM with multi-threading or not.
Post Reply