|
安装php 5.3.8
# tar -jxvf php-5.3.8.tar.bz2
# cd php-5.3.8
# ./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache/bin/apxs
报错:
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
解救措施:
[iyunv@Webmail php-5.3.8]# rpm -qa |grep libxml2
libxml2-2.7.6-1.el6.x86_64
libxml2-python-2.7.6-1.el6.x86_64
[iyunv@Webmail php-5.3.8]# yum install libxml2-devel -y
重新configure,如果成功的话应该会下列提示:
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
编译
# make
# make install
Installing PHP SAPI module: apache2handler
/usr/local/apache/build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp5.la /usr/local/apache/modules
/usr/local/apr/build-1/libtool --mode=install install libphp5.la /usr/local/apache/modules/
install .libs/libphp5.so /usr/local/apache/modules/libphp5.so
install .libs/libphp5.lai /usr/local/apache/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/software/php-5.3.8/libs'
chmod 755 /usr/local/apache/modules/libphp5.so
[activating module `php5' in /usr/local/apache/conf/httpd.conf]
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/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/php/lib/php/
[PEAR] Archive_Tar - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.1
[PEAR] PEAR - installed: 1.9.4
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/home/software/php-5.3.8/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
由于版本更新,这些文件有了新的命名:php.ini-production对应于php.ini-recommendedphp.
ini-development对应于php.ini-dist
[iyunv@Webmail php-5.3.8]# ls |grep php.ini
php.ini-development
php.ini-production
php-5.3.8]# cp php.ini-development /usr/local/php/lib/php.ini
添加默认的字符
# vi /usr/local/php/lib/php.ini
;default_charset = "iso-885Array-1"
在这行下面加一行
default_charset = "gbk"
让apache支持php模块
# vi /usr/local/apache/conf/httpd.conf
在文件最后面添加下面两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
然后找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
注意:改变了http.conf后,要重启apache服务器,否则不会生效!
如果在启动apache的时候有这样的报错,那就给你的主机设一个完整的主机名
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
|
|