php5.3.3 date.timezone再次考虑php.ini指令 [英] php5.3.3 date.timezone again php.ini directive not taken into account

查看:130
本文介绍了php5.3.3 date.timezone再次考虑php.ini指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

系统:Debian Lenny / Apache 2.2 / php5.3.3从源代码编译

System: Debian Lenny/Apache 2.2/php5.3.3 compiled from sources

我在php.ini里遇到date.timezone。

I'm strugglying with the date.timezone within php.ini.

我可以使用php源代码定义TZ,但我想在ini文件中一次性修复它。

I can define the TZ using in the php source code but I'd like to fix that at once in the ini file.

php代码:Ok

date_default_timezone_set('Europe/Berlin');

php.ini :如果没有在源中设置,不考虑代码

php.ini : Not taken into consideration if not setup within the source code

date.timezone = 'Europe/Berlin'

我还检查了我修改了正确的 php.ini 文件,并干扰了一些 php.default.ini 文件。

我在apache配置文件内检查是否会有干扰的TZ env数据,但是没有。

I also checked that I modified the right php.ini file and have interference with some php.default.ini files.
I checked within the apache config files whether there would be an interfering TZ env data, but none.

不知道该怎么做更多的,所以任何提示都将受到欢迎,

Don't know what to do more, so any hints will be welcomed,

thx提前。

编辑:
I也尝试使用no或单引号或双引号作为date.timezone ='欧洲/柏林',但我仍然在phpinfo中获得无价值。

I also tried with no or single or double quotes as date.timezone = 'Europe/Berlin' but I still get a "no value" in the phpinfo.

EDIT2:Both phpinfo()和下面的测试脚本返回date.timezone为空(例如,no value):

Both phpinfo() and the below test script return that the date.timezone is empty (eg. no value) :

 date_default_timezone_set('America/Los_Angeles');
 $script_tz = date_default_timezone_get();
 $iniset = ini_get('date.timezone') ;
 if (strcmp($script_tz, $iniset)){
   echo "Script timezone ($script_tz) differs from ini-set timezone ($initset).";
 } else {
   echo "Script timezone ($script_tz) and ini-set timezone match.";
 }

EDIT3 :哼,我想我发现sthg在 php.ini 中:

EDIT3: hum, I guess I found sthg in the php.ini :

 Configuration File (php.ini) Path : /usr/local/php533/php.ini 
 Loaded Configuration File : VOID !

所以我必须找到确保Apache正在寻找正确的php.ini的方法。

So I have to find the way to make sure Apache is looking for the right php.ini somehow...

推荐答案

希望它可以帮助别人在debian的发行版:

Hope it can help others on debian's like distros :

SOLVED:

需要告诉Apache加载想要的 php.ini 文件

上下文:

加载为Apache模块的PHP(例如DSO)

Context:
PHP loaded as an Apache module (eg DSO)

简而言之:

shell ENV

HOW in short :
shell ENV

PHP_INI_SCAN_DIR=/pathtophpini
export PHP_INI_SCAN_DIR

http.conf

http.conf

# ...
# DSO Modules: PHP as an Apache module
SetEnv PHPRC /usr/pathtophpini
SetEnv PHP_INI_SCAN_DIR /usr/pathtophpini

LoadModule php5_module /pathtophpmod/libphp5.so
PHPINIDir /pathtophpini
# ...

Shell

/etc/init.d/apache2 restart   

现在只需检查加载的配置文件 php.ini 是否是正确的在命令行或phpinfo()中使用php-cli:

Now just checking that the loaded configuration file php.ini is the right one either using the php-cli in commandline or phpinfo() :

/path/to/your/phpcli/bin/php -i | grep php.ini | tail -n2   
# which gives you the expected answer
Configuration File (php.ini) Path => /pathtophpini/php.ini
Additional .ini files parsed => /pathtophpini/php.ini

更多文档:

在这个非常特殊的点,只要有很少的文档在这个问题上,因为这是apache和php事务之间的一种共同的责任主题:

stackoverflow

在php手册

askapache

这篇关于php5.3.3 date.timezone再次考虑php.ini指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆