1,下載並安裝libxml2,php安裝依賴
(1)下載地址:http://xmlsoft.org/
(2)#cp/home/xxx/Downloads/libxml2-2.7.2.tar.gz /usr/local/src #把下載的壓縮文件拷貝到src目錄
(3)#cd/usr/local/src
(4)#tar-zxvf libxml2-2.7.2.tar.gz #解壓
(5)#cdlibxml2-2.7.2
(6)#./configure --prefix=/usr/local/libxml2
(7)#make
(8)#makeinstall
2,安裝re2c
(1)下載地址:http://re2c.org/
(2)#cp /home/xxx/Downloads/re2c-0.13.6.tar.gz /usr/local/src #把下載的壓縮文件拷貝到src目錄
(3)#cd/usr/local/src
(4)#tar-zxvf re2c-0.13.6.tar.gz #解壓
(5)#cd re2c-0.13.6
(6)#./configure --prefix=/usr/local/re2c
(7)#make
(8)#make install
3,安裝php
(1)下載php5.4.28(之前在一頁面上隱約看見有人說5.5以後不支持windows,爲了保險兼容,安裝5.4)
地址:http://www.php.net/downloads.php
(2)#cp /home/xxx/Downloads/php-5.4.28 /usr/local/src #把下載的壓縮文件拷貝到src目錄
(3)#cd /usr/local/src
(4)#tar -zxvf php-5.4.28.tar.gz #解壓
(5)#cd php-5.4.28
(6)#./configure
--prefix=/usr/local/php-5.4.28
--with-config-file-path=/usr/local/php-5.4.28/etc
--with-apxs2=/usr/local/apache2/bin/apxs
--with-libxml-dir=/usr/local/libxml2
--with-mysql=/usr
--with-mysqli
--with-pdo-mysql
--enable-soap
--with-gd
--enable-sockets
--enable-mbstring
--disable-ipv6
--enable-exif
--with-zlib
--with-curl
--with-curlwrappers
--enable-calendar
--with-gettext
--enable-gd-native-ttf
--with-bz2
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-iconv-dir
--with-snmp
--with-pear
--with-xpm-dir
--with-t1lib
--with-mcrypt
--with-mhash
--with-openssl
--with-xmlrpc
--with-xsl
--enable-exif
--enable-wddx
--enable-zip
--enable-bcmath
--enable-ftp
--enable-shmop
--enable-dba
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
點回車後出現錯誤:
configure: error:Cannot find MySQL header files under /usr/lib/mysql
Note that the MySQL Client library isnot boundled anymore.
#find / -name mysql.h #查找mysql頭文件,沒找到
#apt-get install libmysqlclient-dev #安裝dev
#(注)red-hat下使用rpm -ivh MySQL-devel-4.1.12-1.i386.rpm安裝(來自網絡文章)
#find / -name mysql.h
/usr/include/mysql/mysql.h #找到呢
configureerror:please reinstall the libcurl distribution - easy.h should be in<curl-dir>/include/curl/
#apt-get install curl libcurl3 libcurl3-devphp5-curl
#安裝完後重啓apache2
#sudo service apache2 restart
#如果仍有問題,修改php.ini文件,在最後加上一行:extension=curl.so
configure: error: jpeglib.h not found.
#apt-get install libjpeg-dev
configure: error: png.h not found.
#apt-get install libpng-dev
configure: error: Please reinstall the BZip2distribution
在bzip.org下載最新的bzip2-1.0.6.tar.gz,解壓並make &&make install
configure: error: libXpm.(a|so) not found.
#apt-get install libxpm-dev
繼續執行,仍然報同樣的錯誤。
可是明明已經安裝了啊,
#find / -name libXpm.so
原來是安裝在/usr/lib/i386-linux-gnu/libXpm.so下面。
#ln -s /usr/lib/i386-linux-gnu/libXpm.so/usr/lib/libXpm.so
configure: error: freetype.h not found.
#apt-get install libfreetype6-dev
configure: error: Your t1lib distribution is not installed correctly.Please reinstall it.
#apt-get install libt1-dev
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
#apt-get install libmcrypt-dev
configure: error: xslt-config not found. Please reinstall the libxslt>= 1.1.0 distribution
#apt-get install libxslt-dev
configure: error: Could not findnet-snmp-config binary, Please check your net-snmp installation.
重新安裝net-snmp: http://www.net-snmp.org/wiki/index.php/Net-Snmp_on_Ubuntu
下載:http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2.1/
先安裝perl
#apt-get install libperl-dev
然後再裝net-snmp
#tar -zxvf net-snmp-5.6.2.1.tar.gz
#cd net-snmp-5.6.2.1
#./configure --with-default-snmp-version="3"--with-sys-contact="@@no.where"--with-sys-location="Unknown"
--with-logfile="/var/log/snmpd.log"--with-persistent-directory="/var/net-snmp"
#make
#make install
(7)重新檢查,全部通過
(8)#make
出現錯誤:
make: *** [sapi/cli/php] Error 1
google ,
網上解決方法:
方法一:
#vim Makefile
找到"EXTRA_LIBS"這一行,在最後加上"-liconv"
方法二:
make ZEND_EXTRA_LIBS='-liconv'
木用,
#find / -name libiconv.so.2
沒找到,可能是沒安裝,
於是安裝libiconv
下載地址:
http://www.gnu.org/software/libiconv/
http://mirror.bjtu.edu.cn/gnu/libiconv/
#tar -zxvf libiconv-1.10.tar.gz
#./configure --prefix=/usr/local/libiconv
#make
#make install
(9)#./configure重新檢查
(10)make
出現錯誤:
libxslt.so:undefined reference to ........
安裝libxslt
#apt-get install libxslt1-dev
重新configure和make,仍然不能通過,
googlebaidu搜遍地球和宇宙,花了兩天工夫,仍然不能解決這個xslt的錯誤。
無奈放棄,從configure參數裏去掉--with-xsl,
#./configure .......
#make
成功
#make test
(11)#make install
(12)安裝成功
4,配置php
(1)#cd /usr/local/php-5.4.28/etc
(2)#cp /usr/local/src/php-5.4.28/php.ini-production php.ini
(3)#vim php.ini
修改三個參數(drupal項目裏已經出現的錯誤對應):
max_execution_time = 60
max_input_time = 120
upload_max_filesize=8M(默認爲2M)
(4)修改apache配置文件以支持php
i,#cd /usr/local/apache2/conf
ii,#vim httpd.conf
iii,找到AddType application/x-gzip .gz .tgz 這一行,在下面加上
AddType application/x-httpd-php .php
iv,找到
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
這一節,
修改裏面的這一行,在後面加上index.php,
DirectoryIndex index.html index.php
v,重啓apache服務
vi,#cd /data/www 移到網站根目錄
vii,#vim index.php 建立一個php文件
在裏面輸入
<?php phpinfo(); ?>
保存。
viii,切換到圖形模式,打開瀏覽器,輸入
vvi,如果能正常顯示頁面,出現配置信息,說明安裝配置成功。
php安裝可參見:http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi:troubleshoot