how do I set the PATH to use ImageMagick under PHP on my Server?

Hi,
I have the ImageMagick binaries installed. They are working in the terminal.
But when I try to use it out of a php script on the webserver, it cant find the DYLD_LIBRARY_PATH.

The manual says:
Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:
export MAGICK_HOME="$HOME/ImageMagick-6.3.7"

If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:
export PATH="$MAGICK_HOME/bin:$PATH"

Set the DYLD_LIBRARY_PATH environment variable:
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

I can do all this in the Terminal, but how and where do I set it, that it also works with the scripts on the webserver?

Thanks and Regards,
JO

MacPro, XServer and MacBook Pro, Mac OS X (10.5.1)

Posted on Dec 21, 2007 11:35 PM

Reply
3 replies

Dec 24, 2007 9:25 PM in response to Joachim Frey

Joachim,

I have not tested any of this but...

If you are just using the default Mac OS X Server install of Apache and the PHP module, then Apache's path is /usr/bin:/bin:/usr/sbin:/sbin (when running under the user:group=www:www). Basically, if the server is running under that user and PHP inherits the basic PATH of that user's shell, then anything linked into those directories should be available to the scripts, i.e. link your ImagMagick bin and lib paths into /usr 's directories. See 'man ln' in Terminal. User www doesn't have a defined shell, though, so I don't know where the PATH comes from.

Alternatively, you might be able to use Apache's env_module (on by default) to manipulate the PATH environment variable in a config file. See Apache's manual on environment variables.

Another means is to utilize 'suexec' in Apache and switch the user:group of CGI execution, etc. to a actual user with a definable .bash_profile (or whatever shell you are using). There are security concerns with this. See Apache's manual on suexec. You may want to also consider compiling PHP as CGI.

BTW: the new version of PHP has some new experimental native ImageMagick libraries built in. I assume it looks for the binaries in the usual places and/or may need to be compiled with their paths during ./configure.

Larry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how do I set the PATH to use ImageMagick under PHP on my Server?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.