PHP安裝與配置

來源:文萃谷 3.06W

導語:PHP安裝與配置需要執行一些命令。下面就由小編為大家介紹一下PHP安裝與配置,歡迎大家閲讀!

PHP安裝與配置

PHP安裝前提

Apache已安裝

PHP安裝

cd /data/software

wget

tar -zxvf

cd php-7.1.8

./configure --with-apxs2=/usr/local/httpd/bin/apxs --with-mysqli --prefix=/usr/local/php

make

make install

PHP配置

cp -development /usr/local/php/lib/

vi /usr/local/httpd/conf/

去掉如下註釋

LoadModule php7_module modules/

增加如下配置

SetHandler application/x-httpd-php

重啟Apache

cd /usr/local/httpd/bin

./apachectl restart

PHP安裝檢測

假設Apache工作目錄為/www/cz/com Apache監聽端口為:10086

cd /www/cz/com

vi

內容如下

在瀏覽器內打開如下地址:http://localhost:10086/

如果顯示了php的信息,則説明安裝成功

錯誤處理

錯誤:virtual memory exhausted: Cannot allocate memory

make: *** [ext/fileinfo/libmagic/] Error 1

解決:./configure改為

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli --prefix=/usr/local/php --disable-fileinfo

熱門標籤