centos环境下apache支持PHP配置的一个Bug

时间:2022-10-23 09:32:39

遇到一个Bug,详细如下:

PASS Bug #55755 (SegFault when outputting header WWW-Authenticate) [sapi/cli/tests/php_cli_server_006.phpt] 
PASS Bug #55758 (Digest Authenticate missed in 5.4) [sapi/cli/tests/php_cli_server_007.phpt] 
PASS SERVER_PROTOCOL header availability [sapi/cli/tests/php_cli_server_008.phpt] 
PASS PATH_INFO (relevant to #60112) [sapi/cli/tests/php_cli_server_009.phpt] 
PASS Bug #60180 ($_SERVER["PHP_SELF"] incorrect) [sapi/cli/tests/php_cli_server_010.phpt] 
PASS Bug #60159 (Router returns false, but POST is not passed to requested resource) [sapi/cli/tests/php_cli_server_012.phpt] 
PASS No router, no script [sapi/cli/tests/php_cli_server_013.phpt] 
PASS Bug #60477: Segfault after two multipart/form-data POST requestes [sapi/cli/tests/php_cli_server_014.phpt] 
PASS Bug #60523 (PHP Errors are not reported in browsers using built-in SAPI) [sapi/cli/tests/php_cli_server_015.phpt] 
PASS Bug #60591 (Memory leak when access a non-exists file) [sapi/cli/tests/php_cli_server_016.phpt] 
PASS Implement Req #60850 (Built in web server does not set $_SERVER['SCRIPT_FILENAME'] when using router) [sapi/cli/tests/php_cli_server_017.phpt] 
PASS Implement Req #61679 (Support HTTP PATCH method) [sapi/cli/tests/php_cli_server_018.phpt] 
PASS Implement Req #65917 (getallheaders() is not supported by the built-in web server) [sapi/cli/tests/php_cli_server_019.phpt] 
SKIP file upload greater than 2G [sapi/cli/tests/upload_2G.phpt] reason: need +3G free RAM
SKIP FPM: version string [sapi/fpm/tests/001.phpt] reason: FPM not found
SKIP FPM: Startup and connect [sapi/fpm/tests/002.phpt] reason: FPM not found
SKIP FPM: Apparmor Test [sapi/fpm/tests/apparmor.phpt] reason: FPM not found
=====================================================================
TIME END 2018-12-04 08:16:10

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   52
Exts tested     :   27
---------------------------------------------------------------------

Number of tests : 13320              8857
Tests skipped   : 4463 ( 33.5%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :   31 (  0.2%) (  0.4%)
Tests passed    : 8826 ( 66.3%) ( 99.6%)
---------------------------------------------------------------------
Time taken      :  224 seconds
=====================================================================

=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
Test open_basedir configuration [tests/security/open_basedir_linkinfo.phpt]  XFAIL REASON: BUG: open_basedir cannot delete symlink to prohibited file. See also
bugs 48111 and 52176.
Inconsistencies when accessing protected members [Zend/tests/access_modifiers_008.phpt]  XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Inconsistencies when accessing protected members - 2 [Zend/tests/access_modifiers_009.phpt]  XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770.phpt]  XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_2.phpt]  XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_3.phpt]  XFAIL REASON: See Bug #48770
Bug #63336 (invalid E_NOTICE error occur) [Zend/tests/bug63336.phpt]  XFAIL REASON: Bug is not fixed yet
Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects) [Zend/tests/bug64896.phpt]  XFAIL REASON: We can not fix this bug without a significant (performace slow down) change to gc
Initial value of static var in method depends on the include time of the class definition [Zend/tests/method_static_var.phpt]  XFAIL REASON: Maybe not a bug
DateTime::add() -- fall type2 type3 [ext/date/tests/DateTime_add-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- fall type3 type2 [ext/date/tests/DateTime_add-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- fall type3 type3 [ext/date/tests/DateTime_add-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type2 type3 [ext/date/tests/DateTime_add-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type3 type2 [ext/date/tests/DateTime_add-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type3 type3 [ext/date/tests/DateTime_add-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type2 type3 [ext/date/tests/DateTime_diff-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type3 type2 [ext/date/tests/DateTime_diff-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type3 type3 [ext/date/tests/DateTime_diff-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type2 type3 [ext/date/tests/DateTime_diff-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type3 type2 [ext/date/tests/DateTime_diff-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type3 type3 [ext/date/tests/DateTime_diff-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type2 type3 [ext/date/tests/DateTime_sub-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type3 type2 [ext/date/tests/DateTime_sub-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type3 type3 [ext/date/tests/DateTime_sub-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type2 type3 [ext/date/tests/DateTime_sub-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type3 type2 [ext/date/tests/DateTime_sub-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type3 type3 [ext/date/tests/DateTime_sub-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd2) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt]  XFAIL REASON: Still not quite right
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fs) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt]  XFAIL REASON: Still not quite right
Bug #42718 (unsafe_raw filter not applied when configured as default filter) [ext/filter/tests/bug42718.phpt]  XFAIL REASON: FILTER_UNSAFE_RAW not applied when configured as default filter, even with flags
Bug #67296 (filter_input doesn't validate variables) [ext/filter/tests/bug49184.phpt]  XFAIL REASON: See Bug #49184
=====================================================================

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text): nianhuaiju@qq.com
sh: autoconf: command not found

Posting to http://qa.php.net/buildtest-process.php

Thank you for helping to make PHP better.
[haochuang@VM_24_78_centos php-5.6.2]$ 

 

问题已上报,后续再继续跟踪。。。

 

需要准备一个web站点,是php环境的,准备lamp环境。目前对PHP没有要求,全部用yum 一键安装。

#yum 安装Apache
yum install httpd 

 

php编译安装

安装前记得安装php依赖环境:

# yum安装PHP5.6的依赖环境

yum -y install gcc gcc-c++ libxml2 libxml2-devel

 

PHP5.6.2下载路径

wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz

 

安装

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/php/etc --enable-fpm --enable-mbstring --enable-gd --enable-xml
#有需要的PHP拓展的自己编译的时候加上

make && make install 

 

 

其他可参考的configure信息

/configure --prefix=/usr/local/php \         #PHP安装路径
--with-apxs2=/usr/local/apache/bin/apxs \        #--with-apxs2指向Apache的apxs路径
--with-config-file-path=/usr/local/php/etc      #PHP配置文件路径
--enable-fpm --enable-mbstring --enable-gd --enable-xml         #加载fpm、mbstring模块
--with-mysql=/usr/local/mysql       #支持MySQL 替换成MySQL路径。

补充

[bgop@VM_24_78_centos php-5.6.2]$ sudo make install
[sudo] password for bgop: 
/bin/sh /home/bgop/php-5.6.2/php-5.6.2/libtool --silent --preserve-dup-deps --mode=install cp ext/opcache/opcache.la /home/bgop/php-5.6.2/php-5.6.2/modules
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man page:      /usr/local/php/man/man1/
Installing PHP CGI binary:        /usr/local/bin/
Installing PHP CGI man page:      /usr/local/php/man/man1/
Installing build environment:     /usr/local/lib/php/build/
Installing header files:          /usr/local/include/php/
Installing helper programs:       /usr/local/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/lib/php/
[PEAR] Archive_Tar    - already installed: 1.3.12
[PEAR] Console_Getopt - already installed: 1.3.1
[PEAR] Structures_Graph- already installed: 1.0.4
[PEAR] XML_Util       - already installed: 1.2.3
[PEAR] PEAR           - already installed: 1.9.5
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/home/bgop/php-5.6.2/php-5.6.2/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar
Installing PDO headers:          /usr/local/include/php/ext/pdo/

 

 

复制PHP配置文件。

cp php-5.6.2/php.ini-development  /usr/local/php/etc/php.ini 

 

修改Apache的配置文件httpd.conf

DirectoryIndex index.html index.php #添加index.php

找到:

AddType  application/x-compress .Z

AddType application/x-gzip .gz .tgz

添加如下内容

AddType application/x-httpd-php-source .phps

AddType application/x-httpd-php .php

检查LoadModule php5_module modules/libphp5.so 是否已经添加 libphp5.so文件是否存在

 

编写测试文件index.php内容如下,放到Apache的默认的Web站点目录DocumentRoot     #默认路径/var/www/html

<?php

phpinfo();

?>

启动Apache服务,若启动失败,查看配置文件httpd.conf,找到错误日志error.log,针对问题修改。

service httpd restart

用浏览器访问http://IP/,可以查看到PHP配置就表示你成功了。