Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Configure Apache on Mac OSX with Environment Variables

View configure-apache-path-environment-variable-on-macosx.md

Configure Apache Path Environment Variable on Mac OSX

Problem: Apache2/PHP did not find a program to execute on its configured path

Solution: Add a new path of /usr/local/bin to Apache2's path where the program was installed

  1. Edit the Apache2 plist file with whatever editor you like (example using vim):

    $ sudo vim /System/Library/LaunchDaemons/org.apache.httpd.plist
    
  2. Add the following to the the plist file:

    <key>EnvironmentVariables</key>
    <dict>
      <key>PATH</key>
      <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
    </dict>
    
  3. Restart Apache2

    $ sudo /usr/sbin/apachectl stop
    $ sudo /usr/sbin/apachectl start
    

Thank you.

It did the trick for me. :)

This should be added at the end? or inside the main block?

On Yosemite it doesn't help. Here is my config

<?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">
<dict>
    <key>Disabled</key>
    <true/>
    <key>Label</key>
    <string>org.apache.httpd</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>XPC_SERVICES_UNAVAILABLE</key>
        <string>1</string>
        <key>PATH</key>
        <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
    </dict>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/sbin/httpd</string>
        <string>-D</string>
        <string>FOREGROUND</string>
    </array>
    <key>OnDemand</key>
    <false/>
</dict>
</plist>

but "echo getenv("PATH");" shows only /usr/bin:/bin:/usr/sbin:/sbin

Works fine for me on Yosemite

Like @salex772 it doesn't work for me on 10.10.1. Any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.