Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8411825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:31:22+00:00 2026-06-10T00:31:22+00:00

I am using PHP’s exec() to convert an image using ImagicMagick’s convert . This

  • 0

I am using PHP’s exec() to convert an image using ImagicMagick’s convert. This is being run on a CentOS server.

exec(convert http://www.google.com/images/srpr/logo3w.png.jpg 
    -resize 640 /home/mysite/public_html/public/img/posts/original/1414_301a4.jpg);

Using exec() does not cause the new image to appear in the destination folder. However if I were to run the same command in the shell, it works perfectly!

I believe this is a PATH problem. If so, how can I check the path that PHP is using, and how can I set the correct path in PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:31:23+00:00Added an answer on June 10, 2026 at 12:31 am

    First, you should try with an input file that does indeed exist and is retrievable:

    wget http://www.google.com/images/srpr/logo3w.png.jpg
    
      --2012-08-21 20:55:24--  http://www.google.com/images/srpr/logo3w.png.jpg
      Resolving www.google.com (www.google.com)... 173.194.35.179, 173.194.35.177, 173.194.35.178, ...
      Connecting to www.google.com (www.google.com)|173.194.35.179|:80... connected.
      HTTP request sent, awaiting response... 404 Not Found
      2012-08-21 20:55:24 ERROR 404: Not Found.
    

    Then, to see which convert your PHP uses:

    exec(which convert 2>/tmp/whichconvert.2 1>whichconvert.1)
    

    and

    cat /tmp/whichconvert.{1,2}
    

    Last, also try with the full path to convert:

    exec(/usr/local/full/path/to/convert logo: 
    -resize 640 /home/mysite/public_html/public/img/posts/original/1414_301a4.jpg);
    

    and then

    identify /home/mysite/public_html/public/img/posts/original/1414_301a4.jpg
    

    Update:

    The file that you meant to retrieve was probably not logo3w.png.jpg, but logo3w.png:

      wget http://www.google.com/images/srpr/logo3w.png
      --2012-08-21 21:04:22--  http://www.google.com/images/srpr/logo3w.png
      Resolving www.google.com (www.google.com)... 173.194.35.180, 173.194.35.177, 173.194.35.179, ...
      Connecting to www.google.com (www.google.com)|173.194.35.180|:80... connected.
      HTTP request sent, awaiting response... 200 OK
      Length: 7007 (6.8K) [image/png]
      Saving to: ‘logo3w.png’
      
      100%[=====================================================>] 7,007       --.-K/s   in 0.02s   
      
      2012-08-21 21:04:22 (451 KB/s) - ‘logo3w.png’ saved [7007/7007]
    

    Also, in case it works for local files only (not remote http-URIs) you may need to check if the http delegate used by convert is indeed installed on your system:

    convert -list delegate | grep http
          https =>          "/opt/local/bin/curl" -s -k -o "%o" "https:%M"
    

    Plus, check if the user account your PHP runs under does indeed have the right to write to the target directory:

    exec(touch /home/mysite/public_html/public/img/posts/original/touchtest);
    

    and then

    ls -l  /home/mysite/public_html/public/img/posts/original/touchtest
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using PHP I'm trying to download/save the following image: http://www.bobshop.nl/catalog/product_image.php?size=detail&id=42428 When you load this
using php or javascript or ajax how to replace specific link to * http://www.google.com/
Using PHP, what's the fastest way to convert a string like this: 123 to
Using PHP I echo out table rows in a loop like this: <?php /*
Using PHP 5.3.3, PostgreSQL 8.4.11, pgbouncer 1.3.4 (in session mode) on CentOS 6.2 I'm
Using PHP, I can convert MySQL data or static table data to csv, Excel,
Using php-sdk I obtain pages in this way: $array = $this->instance->api( '/' . $fb_user
Using php i wants to make a join query across 2 database. This is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Using PHP's ReflectionClass. Is this possible? I want to get a list of methods

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.