我正试图在CentOS上将PHP从5.2升级到5.3,但phpinfo()仍然声称安装了PHP 5.2。
通过编译Apache 1.3然后使用apxs:构建PHP构建的PHP
# cd ../php-5.3.29
# ./configure --with-apxs=/usr/local/apache-php/bin/apxs --with-mysql=/usr/include/mysql --with-gd --with-jpeg-dir --with-png-dir --enable-mbstring --with-mysqli --with-pdo-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-curl=/usr
# make
# make test
# make install
这似乎奏效了。我重新启动了整个服务器,然后像这样启动了Apache:
/usr/local/apache-php/bin/httpd -f /path/to/httpd.conf -D PERLDB -DSSL
Apache正在工作,Apache模块服务器状态返回Apache的构建日期为2014年9月16日,这是正确的。然而,phpinfo()显示的是:
PHP Version 5.2.6
Build Date Mar 6 2014
Configure Command './configure' '--with-apxs=/usr/local/apache-centosssl-php/bin/apxs' '--with-mysql=/usr/include/mysql' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--enable-mbstring' '--with-mysqli' '--with-pdo-mysql' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-curl=/usr'
/usr/local/apache-centrosssl-php/是上一个apache版本的路径,该版本于2014年3月编译,适用于PHP5.2。Apache似乎正在启动并使用我以前编译PHP时的一些旧文件?
在命令行上,我得到:
# php -v
PHP 5.3.29 (cli) (built: Sep 16 2014 16:53:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
我在php.ini和httpd.conf中搜索了"apachecentosssl.php",但没有出现。
我忘了在Apache中使用符号链接链接到PHP模块:
libexec -> /usr/local/apache-centosssl-php/libexec
我把它修改成
libexec -> /usr/local/apache-php/libexec
它现在似乎起作用了。