3

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

Thomas Mery
  • 120
  • 8
  • 1
    It's working as you would expect on my end. You understand that the change only affects the execution of the current script and doesn't export the new variable globally, right? (FWIW, I haven't updated to El Capitan yet) – HPierce Oct 07 '15 at 17:54
  • How are you checking your change? I can do a `putenv` of `PATH` that shows up fine with `echo getenv('PATH');` afterwards in the version of PHP that comes with El Capitan, but I've not got MAMP Pro... – Matt Gibson Oct 07 '15 at 20:28

1 Answers1

0

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)