Home > Backend Development > PHP Problem > apache php module installation method

apache php module installation method

藏色散人
Release: 2023-03-03 10:20:01
Original
5756 people have browsed it

apache php module installation method: first download apache from the official website and unzip it; then find and open "httpd.conf" to modify the path; then download and install php, and open "php.ini" to modify the ext in php Path; finally load the module through the syntax LoadModule.

apache php module installation method

# Recommended: "

PHP Tutorial

Prepare a folder in advance to install apache and php.

Step 1Download apache, official: https://www.apachehaus.com/cgi-bin/download.plx


The one above is X86, and the one below is X64. Notice! ! ! It is recommended here that once you choose one (X86 or

(Warm reminder: Click on the picture under Download on the right to download)


Step 2After downloading, unzip the zip to prepared folder.
I want to say here that the apache I am talking about needs to be installed manually. There is an installation wizard version, but it is difficult to find, but if you know it, it will be fine.
Manual installation:
Open the file you just decompressed, enter the directory Apache24\conf, find httpd.conf, and click in (it is best to use a compiler with line numbers to click in, but it doesn’t matter, you can do it.), Find Define SRVROOT and modify it as shown below:

apache php module installation method
Note here that Define SRVROOT is followed by the path of your apache. I am here to provide a reference for you to refer to the format. Rather than asking you to copy it completely! Also pay attention! The path here is no longer a slash! ! ! Remember to save and exit after making changes.


Step 3Search cmd in the lower left corner and right-click to run as administrator as shown in the figure:

apache php module installation method


# #Step 4

Enter in the command line: "bin/httpd.exe in your apache directory" -k install -n apache. (The meaning of this command is to install the apache server and name the server apache)

(Note that the double quotes here are English double quotes.)
As shown in the picture:
apache php module installation method (There may be a problem here, that is, port 80 is occupied (you can use the cmd command netstat -a or task manager to view port 80). When port 80 is occupied, as shown in the figure)

apache php module installation method(In this case, you can go back to the httpd.conf file, find: Listene 80, change the 80 port to another port and save the httpd.conf file. Or you can Use the task manager to forcefully close the program occupying port 80.)
Errors reported here must be corrected before the service can be started. The translation is, before the service can be started, it must be corrected here. Reported errors means success if no error is reported. If an error is reported, you can copy the error message and search for the corresponding solution in Baidu.

If no error pops up, then the installation is successful. Next, open the ApacheMonitor in the bin in your apache and start apache.

(Here is a possible error, that is If VC11 is not installed, I won’t go into details here. You can use Baidu, but please note that the versions of apache and php are the same as yours, X64 or X86)
The sign of successful installation is to start the apache server and open the web page to search http:// /localhost. As shown in the figure, it is considered successful:

apache php module installation methodThe above is the installation process of apache.


Step 5

Install php: Official: http://windows.php.net/download. It is recommended to download: php-7.1.20-Win32-VC14-x64. Because there are several plug-ins with good compatibility in this version.

After downloading, unzip it into a folder with apache (the folder you prepared at the beginning)
1.php.ini-development file, rename it to php.ini (small problem: if your computer changes If the php.ini-development type is not available, you can change it in the compressed package and then decompress it.)

2. Open this file (php.ini) and find extension_dir = “ext”. Put the double quotes inside Replace the content with the ext path in your php, as shown in the picture:
apache php module installation method
Note here: the semicolon in front needs to be removed, the semicolon here means commenting out
Then open the httpd file of apache (the file we just changed). In the next line of this file #LoadModule, add the following code
LoadModule php7_module E:/apm/php/php7apache2_4.dll (this is not complete Copy!!! The path here is the path of the file php7apache2_4.dll. Yours may not be php7, it may be php5. Pay attention to flexible changes)
PHPIniDir "E:/apm/php" (the same here) , here is the path to your php)
AddType application/x-httpd-php .php .phtml (you can copy it completely here)
As shown: apache php module installation method
Here is an explanation of the above code:
LoadModule is the syntax for loading modules. Its standard is:
LoadModule module name module implementation file

php7_module is the module name for Apache to load the PHP preprocessor.
The module file of the PHP preprocessor (that is, php7apache2_4.dll) is in the PHP installation directory, that is, in the php (mine is called php) file that exists in the same folder as apache, as shown in the figure:
apache php module installation method
There is a new Mysql file here, which is not the content of this chapter, so it is irrelevant, so don’t worry about it.

The sign of successful integration is to create a php file in Apache24\htdocs. It can be called anything. Here we take test as an example.
apache php module installation method
The content is
phpinfo();
?>
After saving and exiting, use a browser to access http://localhost/test.php. If the following picture appears, the integration is successful.
apache php module installation method
I said it is quite simple, but it will not be that simple to do. A small mistake may lead to failure, so you have to be patient.
By the way, you also need to make sure that the web page has this thing:
apache php module installation method


The above is the title content, and the following is what I learned during the operation. Little knowledge I got

Little knowledge, about deleting the command line, it is sc delete the name of the thing you want to delete.
As shown in the example:
apache php module installation method
I have installed several mysql before. There are many mysql in Computer Management->Services and Applications->Services, and I deleted them through this command line. .

Another little knowledge: The reason why some setting changes cannot take effect is because the server has not been restarted, such as the apache server and mysql server. Just restart the server and try again.


The above is the detailed content of apache php module installation method. 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