简体   繁体   English

如何在Apache中为ImageMagick设置路径,以便可以从PHP system()运行?

[英]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 ...') 我正在使用ImageMagick进行图像转换,从PHP使用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). 这对我在一个实例(CentOS 6)上工作正常,但对另一个实例(ImageMagick在/ usr / local / bin中的CentOS 5)静默失败。 On that one, I have to run system('/usr/local/bin/convert -option $file ...') 在那一个上,我必须运行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 问题是,如何在Apache中设置路径,以便convert可以在没有前面的/usr/local/bin

You can export /usr/local/bin to ImageMagick into your PATH environment variable. 您可以将/ usr / local / bin导出到ImageMagick到PATH环境变量中。 This is often done via your .profile or .bash_profile. 这通常是通过您的.profile或.bash_profile完成的。

For example you can see what is in your PATH via 例如,您可以通过看到PATH中的内容

echo $PATH

If it does not include /usr/local/bin, then edit your .profile file (simple text) and add 如果不包含/ usr / local / bin,则编辑.profile文件(简单文本)并添加

export PATH="/usr/local/bin:$PATH"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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