简体   繁体   中英

How do I set the path in Apache for ImageMagick so I can run from PHP system()?

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM