0

I have a question for the php.ini in root folder, how it can be loaded when reading the page and overwrite the original value.

When I was using the webhosting service, I could simply put the php.ini into root folder, then file will overwrite the existing php.ini value on the original php.ini.

However, I am now trying to use local server for development. I use OSX Server App to setup a server, upgraded php5.4 to 5.5 and check everything is good. The phpinfo function shows nothing wrong. But when I put another php.ini in each folder of developing website, they are not be loaded when page is loading. (Its working if I change the value on original php.ini).

May I ask what I am missing and what should I looking for??

Thank you very much for your help!!

Best regards,

  • Apache1 or Apache2? – Sverri M. Olsen Jan 4 '14 at 9:35
  • @SverriM.Olsen Apache2 – Till Jan 4 '14 at 9:36
0

There will be a difference if you are using mod_php or suPHP. It's likely that you'll be running mod_php, whereas your host will be running suPHP (suPHP comes with the advantage that scripts run as the correct user, not as a general user like nobody which is what mod_php does).

The feature you're looking for, custom php.ini files, is something specific to suPHP. So, there are two solutions to your scenario:

  1. Run suPHP on your local machine
  2. Change the relevant settings in either php.ini or in .htaccess via things like php_flag

Personally, I'd recommend running your local setup as close to production as possible; so I'd opt for option one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.