Apache cannot parse PHP program under Linux server

WBOY
Release: 2016-07-29 08:55:45
Original
1229 people have browsed it

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
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!