Stops Converting via PHP but works via command line

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
croeder

Stops Converting via PHP but works via command line

Post by croeder »

Imagemagick script executed via exec works for a while then just stops. If I take the command and execute it via command line it works fine. Anyone have any ideas what might cause the script not to work via the php script? Command is below that works via cmd line but not php script.

convert "http://www.rvsearch.com/images/customer ... %20110.jpg" -resize 75 "/mnt/Cache/ts-rvs/customers/159815/582340/75_PPictures2009110.jpg"
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stops Converting via PHP but works via command line

Post by fmw42 »

perhaps php does not give you adequate permissions or too short a time-out to process images from http access
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Stops Converting via PHP but works via command line

Post by anthony »

Does it find the "convert" command?

What does the PHP errors say?

Have as look at methods of handling and looking at errors in PHP
http://www.cit.griffith.edu.au/~anthony ... /php.hints

I squirrelled these notes for a local user when I looked at PHP error handling on our systems (student teaching servers).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
croeder

Re: Stops Converting via PHP but works via command line

Post by croeder »

After adding the -debug all,trace to the command I get "no data returned `http://www.rvsearch.com/images/customer ... %20110.jpg'". The problem is that if I go to the URL directly it works fine. Another thing is that it will work for a while before it stops working. Its almost like ImageMagick wasn't able to get the image at some time and it cached that response using it going forward instead of re-trying the request.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stops Converting via PHP but works via command line

Post by fmw42 »

try clearing the cache or temporary files from your browser
croeder

Re: Stops Converting via PHP but works via command line

Post by croeder »

The caching for this page is explicitly set to non-cacheable. Even after clearing the cache and tmp the convert cmd fails.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stops Converting via PHP but works via command line

Post by fmw42 »

I still suspect a timeout issue or more likely a security issue under PHP.
Post Reply