问题描述
配置:
MAMP Pro
PHP 5.6.1
Mac OS X El Capitan
我需要添加 / user / local / bin
到系统路径php可以访问
我试图使用putenv()
但似乎我无法使用putenv()更改php中的环境变量PATH的值
putenv('PATH ='。'/ user / local / bin'。PATH_SEPARATOR。getenv('PATH'));
不更改值
这适用于其他变量
PATH似乎受到保护,我可以没有弄清楚我可以在哪里取消保护 - php ini设置似乎没有关于非安全模式env vars的任何东西。
是否与任何人打响? / p>
谢谢
可能受到新的rootless或SIP (系统完整性保护)。我不建议禁用此功能,除非您真的知道您正在做什么,但禁用它可以解决您的问题。
(维基百科页面)
以及如何(OS X每天)
Config:MAMP ProPHP 5.6.1Mac 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
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)
这篇关于无法使用putenv()运行MAMP / PHP 5.6.1 / Mac OS X El Capitan来修改PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!