Page 1 of 1

Working on SSH but not on PHP

Posted: 2012-05-18T07:53:46-07:00
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

Re: Working on SSH but not on PHP

Posted: 2012-05-18T09:37:53-07:00
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.

Re: Working on SSH but not on PHP

Posted: 2012-05-18T10:00:21-07:00
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>";

Re: Working on SSH but not on PHP

Posted: 2012-05-18T10:17:11-07:00
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.

Re: Working on SSH but not on PHP

Posted: 2012-05-18T10:51:45-07:00
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.