php解析

php安裝完成後,並不能直接使用,需要進行一些配置


拷貝php配置文件

[root@ly-linux php-5.6.28]# cp php.ini-production /usr/local/php/etc/php.ini


配置apache

[root@ly-linux php-5.6.28]# vim /usr/local/apache2/conf/httpd.conf

<Directory  />

Options FollowSymlLinks

AllowOverride None

Order deny,allow

Deny from all               // 此行修改  =====>    Allow from all

</Directory>

AddType application/x-gzip .gz .tgz

#在下方添加一行

AddType application/x-httpd-php .php

<IfModule dir_module>    DirectoryIndex index.html           //此行後添加index.htm  index.php </IfModule>

找到下方語句

#ServerName www.example.com:80

改成

ServerName localhost:80

保存退出。


檢測配置

[root@ly-linux php-5.6.28]#  /usr/local/apache2/bin/apachectl -t

Syntax     //說明沒有問題

[root@ly-linux php-5.6.28]#  /usr/local/apache2/bin/apachectl start

[root@ly-linux php-5.6.28]# ps aux |grep httpd

#檢測apache是否正常啓動


測試php解析

[root@ly-linux php-5.6.28]# vim /usr/local/apache2/htdocs/1.php

<?php    echo "php work"; ?> 保存退出,

[root@ly-linux php-5.6.28]# curl localhost/1.php php work

只有顯示這個纔算成功 。如果不流暢,檢測iptables規則

[root@ly-linux php-5.6.28]# iptables -nvL

如果有一些規則,執行

[root@ly-linux php-5.6.28]# iptables -F

[root@ly-linux php-5.6.28]# service iptables save



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章