Php – How to set default php.ini to be used, OSX Yosemite

apachemacosphp

I set up a new environment using OSX Yosemite.

I'm using the built-in PHP.

I'd like to change some config in php.ini such as date.timezone but none of the modifications are working despite restarting the apache server (sudo apachectl restart).

phpinfo() is giving a different path than php –ini command.

phpinfo():

Configuration File (php.ini) Path /usr/local/php5/lib

Loaded Configuration File /usr/local/php5/lib/php.ini

Via commands :

which php

/usr/bin/php

php –ini

Configuration File (php.ini) Path: /etc

Loaded Configuration File: /etc/php.ini

Scan for additional .ini files in: /Library/Server/Web/Config/php

Additional .ini files parsed: (none)

So I guess I have to tell somewhere where I should set the default php.ini to be used.

Any ideas, hints?

Best Solution

move the configuration file to the right spot and update the timezone.

$ sudo cp /etc/php.ini.default /etc/php.ini

Open the config file /etc/php.ini, find the line that sets your timezone and update it correspondingly.

date.timezone = Europe/Berlin

Do not forget to remove the ; at the beginning. Restart the Apache server to have PHP load the new .ini file.

sudo apachectl restart