php5.4.45安裝方法:1、使用yum安裝httpd並編譯安裝php5.4.45;2、載入libphp5.so模組;3、新增apache解析php檔即可。
本文操作環境:linux5.9.8系統、php5.4.45版,DELL G3電腦
php5.4.45安裝教學
編譯安裝php5.4.45
1.PHP下載位址 http://www.php.net/releases/
2.HTTPD下載位址 http:/ /mirrors.hust.edu.cn/apache/
由於webtatic不對php5.4版本提供支援服務,所以需要手動編譯安裝
https://webtatic.com/packages/php54 /
這其中有兩種情況:
1.yum 安裝httpd,編譯安裝php5.4.45
a. yum install httpd httpd-devel
b. tar zxvf php-5.4.45.tar.gz
cd php-5.4.45
#注意:編譯安裝PHP前,必須確保原來yum安裝的php5.3已經被移出,否則不會產生libphp5.so檔。
./configure --with-apxs2=/usr/sbin/apxs --with-mysql make && make install cp php.ini-development /usr/local/lib/php.ini sed -i 's%;date.timezone =%date.timezone = Asia/Shanghai%' /usr/local/lib/php.ini
驗證/etc/httpd/conf/httpd.conf檔案是否已經載入了libphp5.so模組
grep "libphp5.so" /etc/httpd/conf/httpd.conf
新增apache 解析php檔案
sed '/ .gz .tgz/a\AddType application/x-httpd-php .php' /etc/httpd/conf/httpd.conf
##2.編譯安裝httpd2.2 php5. 4.45a. tar zxvf httpd-2.2.31.tar.gzcd httpd-2.2.31 ls ./configure --enable-so make && make install /usr/local/apache2/bin/apachectl start lsof -i:80 /usr/local/apache2/bin/apachectl stop lsof -i:80 b. cd ../ cd php-5.4.45 ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql make && make install cp php.ini-development /usr/local/lib/php.ini c. sed -i 's%;date.timezone =%date.timezone = Asia/Shanghai%' /usr/local/lib/php.ini
grep "libphp5.so" /usr/local/apache2/conf/httpd.conf
sed '/ .gz .tgz/a\AddType application/x-httpd-php .php' /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/bin/apachectl start echo "<?php phpinfo(); ?>" > index.php
PHP影片教學》
以上是php5.4.45安裝教程的詳細內容。更多資訊請關注PHP中文網其他相關文章!