a) 卸載rpm php包 b) 安裝libcrypt加密組件 解壓縮 ./configure make && make install ln -s /usr/local/lib/libmcrypt.* /usr/lib c) 安裝mhash認證工具 解壓縮 ./configure make && make install ln -s /usr/local/lib/libmhash* /usr/lib d) 安裝mcrypt加密工具 解壓縮 ./configure make && make install e) 安裝php軟件 解壓縮 配置安裝參數 ./configure --prefix=/usr/local/php --with-mcrypt --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php --enable-mbstring ./configure --prefix=/app/php-5.4.43 --with-bz2 --with-curl --with-gd --enable-sockets --with-jpeg-dir=/usr/local/ --with-png-dir=/usr/local/ --enable-gd-native-ttf --with-iconv --enable-fpm --with-libdir=lib64 --with-libxml-dir=/usr/local/ --with-zlib --disable-ipv6 --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-xml ----自己寫的(不一定對啊) 錯誤1:configure: error: xml2-config not found. Please check your libxml2 installation. 解決辦法:yum install libxml2 yum install libxml2-devel gd-devel libjpeg-devel libpng-devel pcre pcre-devel apr apr-utl 編譯及安裝 make && make install f) 生成php的配置文件 cp php.ini-development /usr/local/php/php.ini g) 為php添加ZendGuardLoader模塊,將該模式復制到php安裝目錄的lib/php文件夾 cp ZendGuardLoader.so /usr/local/php/lib/php h) 修改php的配置文件,使php支持ZendGuardLoader模塊 vim /usr/local/php/php.ini zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so zend_loader.enable=1 i) 修改apache配置文件,使apache與php協同工作 vim /usr/local/apache/conf/httpd.conf AddType application/x-httpd-php .php LoadModule php5_module modules/libphp5.so //文件中存在 DirectoryIndex index.php index.html //直接修改,添加上index.php 4. 測試apache與php協同工作 在apache的網頁根目錄下創建測試文件test.php <?php phpinfo(); ?> 重啟apache服務 5. 測試apache與mysql協同工作 在apache的網頁根目錄創建測試文件testsql.php <?php $link=mysql_connect('localhost','root',''); if($link) echo "連接成功!!!!!!"; mysql_close(); ?> 重啟apache服務進行測試安裝php