如何设置要使用的默认php.ini,OSX Yosemite [英] How to set default php.ini to be used, OSX Yosemite
问题描述
我使用OSX Yosemite设置了一个新环境.
I set up a new environment using OSX Yosemite.
我正在使用内置的PHP.
I'm using the built-in PHP.
我想更改php.ini中的某些配置,例如date.timezone,但是即使重新启动apache服务器(sudo apachectl重新启动),所有修改都无法正常工作.
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()与php --ini命令给出的路径不同.
phpinfo() is giving a different path than php --ini command.
phpinfo():
phpinfo():
配置文件(php.ini)路径/usr/local/php5/lib
Configuration File (php.ini) Path /usr/local/php5/lib
已加载的配置文件/usr/local/php5/lib/php.ini
Loaded Configuration File /usr/local/php5/lib/php.ini
通过命令:
哪个php
/usr/bin/php
/usr/bin/php
php --ini
php --ini
配置文件(php.ini)路径:/etc
Configuration File (php.ini) Path: /etc
已加载的配置文件:/etc/php.ini
Loaded Configuration File: /etc/php.ini
扫描以下文件中的其他.ini文件:/Library/Server/Web/Config/php
Scan for additional .ini files in: /Library/Server/Web/Config/php
已解析的其他.ini文件:(无)
Additional .ini files parsed: (none)
所以我想我必须告诉我应该在哪里设置默认的php.ini.
So I guess I have to tell somewhere where I should set the default php.ini to be used.
有什么想法吗?
推荐答案
将配置文件移动到正确的位置并更新时区.
move the configuration file to the right spot and update the timezone.
$ sudo cp /etc/php.ini.default /etc/php.ini
打开配置文件/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
不要忘记删除;;一开始. 重新启动Apache服务器,以使PHP加载新的.ini文件.
Do not forget to remove the ; at the beginning. Restart the Apache server to have PHP load the new .ini file.
sudo apachectl restart
这篇关于如何设置要使用的默认php.ini,OSX Yosemite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!