简体   繁体   中英

OSX default apache process can not run node commands in php

Apache user _www can not run commands such as 'node' in php code.

execWrap("node --version"); // end up with not known command

getenv('path'); // returned limited set of paths

Update:

sudo nano /System/Library/LaunchDaemons/org.apache.httpd.plist

Change:

<key>EnvironmentVariables</key>
    <dict>
    <key>PATH</key
   <string>/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>

And restart apache:

sudo apachectl restart

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