Home > Backend Development > PHP Problem > How to solve the problem of php code not running

How to solve the problem of php code not running

王林
Release: 2023-03-07 07:50:01
Original
8337 people have browsed it

Methods to solve the problem of php code not running: 1. Open the httpd.conf configuration file; 2. Add [LoadModule actions_module modules/mod_actions.so]; 3. Restart the apache service.

How to solve the problem of php code not running

Problem description:

php cannot run under apache.

(Learning video recommendation: java video tutorial)

Solution:

1. Under the apache installation directory, there is an htdocs directory. Now, we create a simple php web page file in this directory.

How to solve the problem of php code not running

2. We "browse" the php web page file in the browser, and the content of the php file is displayed, but php is not running.

How to solve the problem of php code not running

#3. Apache needs to be configured to call the "php language module (engine)" to execute the php code. Apache's main configuration file httpd.conf is required, and its location is: apache installation directory/conf/httpd.conf.

(Related tutorials recommended: apache)

4. Find the location of "Load Module": and add this line at the last position of this series of LoadModules: "LoadModule actions_module modules/mod_actions.so", among the module files in the php5 language package, the php5 language module name is a fixed name, which is: php5_module, the php5 language package is actually the folder of the php language package.

How to solve the problem of php code not running

5. At the end of the apache configuration file, write: LoadModul php5_module "H:/amp/php/php5apache2_2.dll".

How to solve the problem of php code not running

6. Start a new line to set the file with php suffix, which will be executed by this php language module. "AddType application/x-httpd-php .php"

How to solve the problem of php code not running

7. Restart Apache and run the php program you just wrote.

Related recommendations: php training

The above is the detailed content of How to solve the problem of php code not running. For more information, please follow other related articles on the PHP Chinese website!

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