php5 mysql安裝的方法:首先選擇apache2的動態(tài)添加模塊;然后在redhat linux 9上編譯;接著安裝php非cgi版本;最后安裝需要的軟件包即可。
推薦:《php教程》
php5和mysql5的安裝配置
選擇apache2的動態(tài)添加模塊,在redhat linux 9上編譯,安裝php非cgi版本
我所用到的軟件包:
apache 2.0.54php 5.1.4zlib 1.2.3mysql 5.0.22libxml2 2.6.26碰到過的問題:
1. mysql在本地已經(jīng)安裝
對策: rpm -e –nodeps mysql-version-number。其余軟件類似
2. zlib版本過低
對策: 下載新版本安裝,比如zlib-1.2.3.tar.tar
3. mysql的版本不能是帶靜態(tài)庫的安裝版mysql-standard-5.0.22-linux-i686.tar.gz,否則導(dǎo)致php不能configure
對策: 下載源代碼編譯,比如mysql-5.0.22.tar.gz
4. 不要在mount上來的磁盤編譯,特別是ntfs格式的,否則會出莫名其妙的錯誤
5. mysql的configure命令,摘自mysql-5.0.22.tar.gz中的install文件
cflags="-o3" cxx=gcc cxxflags="-o3 -felide-constructors / -fno-exceptions -fno-rtti" ./configure / --prefix=/usr/local/mysql --enable-assembler / --with-mysqld-ldflags=-all-static6. php的configure命令
./configure /--disable-cgi /--with-apxs2=/usr/local/apache2/bin/apxs /--with-mysql=/usr/local/mysql /--with-xml /--with-dom /--with-zlib /--with-libxml /--enable-inline-optimization /--enable-safe-mode /--enable-track-vars /--enable-trans-sid /--enable-xml /--enable-libxml /--enable-so7. 由于每臺機(jī)器上的lib庫不同,在apache2中加載libphp5.so的時候可能會有一些symbol undefined
對策: 更改configure中–enable和–with的選項(xiàng)。如有必要加上–disable-all。注意,–disable-all不安裝php5-extension這個和perl的兼容庫,將會使許多函數(shù)無法運(yùn)行
其余注意點(diǎn)可以在各安裝包的install文件和網(wǎng)上的文章中找到,例如
web server-apache2 php5 mysql5 for linux::apache web server-apache2 php5 mysql5 for linux os::phpweb server-apache2 php5 mysql5 for linux::mysqlweb server-apache2 php5 mysql5 for windows os