can not modify PATH with putenv() running MAMP / PHP 5.6.1 / Mac OS X El Capitan

柔情痞子 提交于 2019-12-22 09:59:56

问题


Config: MAMP Pro PHP 5.6.1 Mac OS X El Capitan

I need to add /user/local/bin to the system paths php can access

I've tried to use putenv()

but it seems like I can't change the value of environment variable PATH in php using putenv()

putenv('PATH=' . '/user/local/bin' . PATH_SEPARATOR . getenv('PATH') );

does not change the value

this works with other variables

PATH seems to be protected and I can not figure out where I can unprotect it - php ini settings do not seem to have anything regarding non-safe mode env vars.

does that ring a bel with anyone?

thanks


回答1:


Possibly protected by the new "rootless" or SIP(System Integrity Protection). I do not recommend disabling this feature unless you really know what you are doing, but disabling it could solve your problem.

More Info Here (wikipedia page) and how to Disable It Here (OS X daily)



来源:https://stackoverflow.com/questions/32999105/can-not-modify-path-with-putenv-running-mamp-php-5-6-1-mac-os-x-el-capitan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!