Apache2, PHP5 and environment variables in OSX

Ok. So I’ve been sitting here with this problem for the last four hours. And finally I found the solution with the help of Jim the Jimbo. Anyway. I’ve been trying to get ImageMagick to work on my OSX/Apache2/PHP-thingy. But I could not figure out how to pass on the PATH variable I added. After a couple of hours Jim found this here page with the solution.

That’s it! I added the following lines to /System/Library/LaunchDaemons/org.apache.httpd.plist:


and got the following results from exec(“export”):

    [0] => export FOO="/bar"
    [1] => export OLDPWD
    [2] => export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
    [3] => export PWD="/Library/WebServer/Documents"
    [4] => export SHLVL="1"

Case solved! Thanks all, thanks Axel.

So that’s what I did. My /System/Library/LaunchDaemons/org.apache.httpd.plist file now looks alittle something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Thanks! I can finally go to sleep! :-)


Men när jag försökte berätta för S vad jag har lyckats med så sa hon …

du är nördigare än vad man tror. glömmer ibland bort det.

… euhm … tack?!!


Posted by David — Share: http://fmasc.net/as
Post new comment to Apache2, PHP5 and environment variables in OSX

Advance users: Click to view allowed XHTML tags.