If the webpage cannot parse php, you can view the source code
Thinking:
Because apache cannot parse php, so you must first check whether php has loaded the parsing php template
1. httpd -M Check whether it exists php5_module
2. If present, Add AddType application/x-httpd-php .php and Change the directory’s default index page to index.php That is DirectoryIndex index.php
The most important point: remember to restart apache, learn from the past, Linux command: apachectl restart restart
Full idea:
# 加载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
The above introduces the inability of Apache to parse the PHP program under the Linux server, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.