您好,登錄后才能下訂單哦!
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.45
a. tar zxvf httpd-2.2.31.tar.gz
cd 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
驗證 /usr/local/apache2/conf/httpd.conf文件是否已經加載了libphp5.so模塊
grep "libphp5.so" /usr/local/apache2/conf/httpd.conf
添加apache 解析php文件
sed '/ .gz .tgz/a\AddType application/x-httpd-php .php' /usr/local/apache2/conf/httpd.conf
d. 驗證
/usr/local/apache2/bin/apachectl start
echo "<?php phpinfo(); ?>" > index.php
查看是否能正常顯示php的配置。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。