Php_开发中碰到的问题_搜集

It is not safe to rely on the system's timezone settings

"PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in"

 

因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入.格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即

<?php date_default_timezone_set("PRC"); ?> 
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。

 

 

PHP FPM

具体的配置和安装等的信息都在:http://cn2.php.net/install.fpm 这里看看

php 5.3源码中已经内嵌了 php-fpm,不用象以前的php版本一样专门打补丁了,只需要在configure的时候添加编译参数即可。

关于php-fpm的编译参数有 –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-libevent-dir=libevent位置。

但是,php 5.3.3 下的php-fpm 不再支持 php-fpm 以前具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:

master进程可以理解以下信号

INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块

示例:
php-fpm 关闭:
kill -INT `cat /usr/local/php/var/run/php-fpm.pid`
php-fpm 重启:
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`

查看php-fpm进程数:

ps aux | grep -c php-fpm

 

PHPUnit安装

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com

sudo pear install phpunit/PHPUnit


Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.1.0)
phpunit/PHPUnit_MockObject can optionally use PHP extension "soap"
downloading PHPUnit-3.6.12.tgz ...
Starting to download PHPUnit-3.6.12.tgz (119,220 bytes)
.....done: 119,220 bytes
downloading File_Iterator-1.3.1.tgz ...
Starting to download File_Iterator-1.3.1.tgz (5,157 bytes)
...done: 5,157 bytes
downloading Text_Template-1.1.1.tgz ...
Starting to download Text_Template-1.1.1.tgz (3,622 bytes)
...done: 3,622 bytes
downloading PHP_CodeCoverage-1.1.3.tgz ...
Starting to download PHP_CodeCoverage-1.1.3.tgz (132,726 bytes)
...done: 132,726 bytes
downloading PHP_Timer-1.0.2.tgz ...
Starting to download PHP_Timer-1.0.2.tgz (3,686 bytes)
...done: 3,686 bytes
downloading PHPUnit_MockObject-1.1.1.tgz ...
Starting to download PHPUnit_MockObject-1.1.1.tgz (19,897 bytes)
...done: 19,897 bytes
downloading YAML-1.0.6.tgz ...
Starting to download YAML-1.0.6.tgz (10,010 bytes)
...done: 10,010 bytes
downloading PHP_TokenStream-1.1.3.tgz ...
Starting to download PHP_TokenStream-1.1.3.tgz (9,860 bytes)
...done: 9,860 bytes
install ok: channel://pear.phpunit.de/File_Iterator-1.3.1
install ok: channel://pear.phpunit.de/Text_Template-1.1.1
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.2
install ok: channel://pear.symfony-project.com/YAML-1.0.6
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.1.3
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.1.3
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.1.1
install ok: channel://pear.phpunit.de/PHPUnit-3.6.12

 

 

Strict standards: mktime(): You should be using the time() function instead

修改php.ini 把报错关掉吧,对类似的遗留的代码只能如此了。

要么就去改代码,地方太多就不好了。

 

  94 ; display_errors
  95 display_errors = Off
  96 ;   Default Value: On
  97 ;   Development Value: On
  98 ;   Production Value: Off

 

 

 

 

你可能感兴趣的:(PHP)