LAMP環境搭配之apache與php結合
阿新 • • 發佈:2018-04-12
lamphttpd主配置文件/usr/local/apache2.4/conf/httpd.conf
vim /usr/local/apache2.4/conf/httpd.conf //修改以下4個地方 ServerName Require all denied AddType application/x-httpd-php .php DirectoryIndex index.html index.php 具體操作: 1,打開這一行ServerName www.example.com:80 2,Require all denied改為Require all granted 3,AddType application/x-compress .Z AddType application/x-gzip .gz .tgz 在上面兩行下面加上這一行,不增加這一行php沒辦法解析 AddType application/x-httpd-php .php 4,DirectoryIndex index.html改為DirectoryIndex index.html index.php 增加一個索引頁
測試語法
/usr/local/apache2.4/bin/apachectl -t
啟動服務
/usr/local/apache2.4/bin/apachectl start
netstat -lntp
curl localhost
編輯測試的php文件
vim /usr/local/apache2.4/htodcs/test.php //增加如下內容
<?php
echo 123;
?>
curl測試
curl localhost/test.php
LAMP環境搭配之apache與php結合