php下载
#cd/usr/local/src/
#wgethttp://cn.php.net/get/php-5.3.6.tar.gz/from/this/mirror
php安装
#tar-zxvfphp-5.3.6.tar.gz
#cdphp-5.3.6
#./configure--prefix=/usr/local/php5.3.6--with-mysql=/usr/local/mysql5.5.9--with-apxs2=/usr/sbin/apxs--enable-mbstring--with-config-file-path=/usr/local/php5.3.6/etc
#make
#makeinstall
ps:
--prefix=/usr/local/php5.3.6指定php安装目录;
--with-mysql=/usr/local/mysql5.5.9指定mysql安装目录;
--with-apxs2=/usr/sbin/apxs指定查找Apache2的地方;
--with-config-file-path=/usr/local/php5.3.6/etc指定php的配置文件目录
php的设定
#cp-prphp.ini-developmentphp.ini
编辑php.ini
#viphp.ini
default_charset="UTF-8"
extension_dir="./ext"
extension=php_mbstring.dll
[mbstring]
mbstring.language=Japanese
mbstring.internal_encoding=UTF-8
mbstring.http_output=UTF-8
Apache的设定
#vi/etc/httpd/conf/httpd.conf
AddTypeapplication/x-httpd-php.php
DirectoryIndexindex.htmlindex.htmindex.html.varindex.php没有如下的文字,追加
LoadModulephp5_module /usr/lib/httpd/modules/libphp5.so
#/etc/init.d/httpdrestart
遇到的问题与解决方案
问题一:
./configure以下错误发生
Sorry,Icannotrunapxs.Possiblereasonsfollow:1.Perlisnotinstalled
2.apxswasnotfound.Trytopassthepathusing--with-apxs2=/path/to/apxs
3.Apachewasnotbuiltusing--enable-so(theapxsusagepageisdisplayed)
解决方法:指定正确的apxs路径
1.查找apxs路径
#whereisapxs
apxs:
说明系统没有安装apxs扩展工具
2.安装apxs
#yuminstallhttpd-devel
3.查找apxs路径
#whereisapxs
apxs:/usr/sbin/apxs/usr/share/man/man8/apxs.8.gz
apxs安装成功
问题二:
安装apxs以下错误发生:
Packagecyrus-sasl-plainneedscyrus-sasl-lib=2.1.22-4,thisisnotavailable.
解决方法:
#yum-yinstallcyrus*
之后再次安装apxs
问题三:
再次./configure以下错误发生
configure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation.
解决方法:
安装libxml2
#yuminstalllibxml2-devel
问题四:
heckinglibxml2installdir...no
checkingforxml2-configpath.../usr/bin/xml2-config
checkingwhetherlibxmlbuildworks...no
configure:error:buildtestfailed.Pleasechecktheconfig.logfordetails.
解决方法:
#yumerasezlib-devel
#yuminstallzlib-devel
#yuminstalllibxml2-devel