思路:
由于 apache 解析不了 php,所以要先看 php 有没有加载解析 php 模版
1. httpd -M 查看能否存在 php5_module假如存在的话,增加AddType application/x-httpd-php .php 和 将目录的默认索引页面改为index.php 即 DirectoryIndex index.php
编辑httpd.conf文件
增加如下代码LoadModule php7_module modules/libphp7.so
AddType application/x-httpd-php .php
DirectoryIndex index.php index.htm index.html最重要的一点:记得重启apache,前车之鉴啊,Linux 指令: apachectl restart 重启
完整思路:
加载php板块
LoadFile "/opt/php-5.3.1/php5ts.dll"
LoadModule php5_module "/opt/php-5.3.1/php5apache2_2.dll"
php.ini文件所在目录
PHPIniDir "/opt/php-5.3.1"
接受到php页面请求时,交给php引擎解释,而不是下载页面
AddHandler php5-script php
AddType application/x-httpd-php .php .php5
AddType application/x-httpd-php-source .phps
将目录的默认索引页面改为index.php
DirectoryIndex index.php