0

I'm using ImageMagick for image conversion, called from PHP using system('convert -option $file ...')

This works fine for me on one instance (CentOS 6), but fails silently on another instance (CentOS 5 where ImageMagick is in /usr/local/bin). On that one, I have to run system('/usr/local/bin/convert -option $file ...')

Question is, how do I set the path in Apache so convert works without the preceding /usr/local/bin

byron
  • 984
  • 3
  • 14
  • 26

1 Answers1

0

You can export /usr/local/bin to ImageMagick into your PATH environment variable. This is often done via your .profile or .bash_profile.

For example you can see what is in your PATH via

echo $PATH

If it does not include /usr/local/bin, then edit your .profile file (simple text) and add

export PATH="/usr/local/bin:$PATH"
fmw42
  • 46,825
  • 10
  • 62
  • 80
  • 1
    That's the thing, I can run convert from the command line no problem. But PHP system() can't (php with apache) – byron Feb 15 '18 at 01:23
  • Sorry I am not a PHP expert. But check your PHP environment variables or your phpinfo.php. Do a Google search or check out http://php.net/manual/en/reserved.variables.environment.php and http://php.net/manual/en/function.putenv.php and https://stackoverflow.com/questions/19696230/how-to-set-global-environment-variables-for-php – fmw42 Feb 15 '18 at 01:36