Home > Article > Backend Development > How to compile and install Apache and PHP
The method to compile and install Apache and PHP is: 1. Download the required Apache and PHP versions and decompress the source code files; 2. In the directory of the Apache and PHP source code, use "./configure" Command to configure Apache, run the "make" and "make install" commands to compile and install Apache; 3. Open the Apache configuration file "httpd.conf" and add the configuration code; 4. Restart the Apache service.
Operating system for this tutorial: Windows 10 system, php8.1.3 version, Dell G3 computer.
How to compile and install Apache and PHP:
1. Download the required Apache and PHP versions and decompress the Apache and PHP source code files.
3. Navigate to the directory of the Apache source code in the terminal and run the following command to configure Apache:
./configure --prefix=/path/to/installation/directory
Change "/path/to /installation/directory" with the path to the directory you chose to install Apache. This command will configure Apache to use the specified installation directory.
4. Run the "make" and "make install" commands to compile and install Apache.
5. Navigate to the PHP source directory and run the following command:
./configure --with-apxs2=/path/to/installation/directory/bin/apxs
6. Run the "make" and "make install" commands to compile and install PHP.
7. Open the Apache configuration file "httpd.conf" and add the following code:
LoadModule php_module /path/to/installation/directory/modules/libphp.so AddHandler php5-script .php
8. Restart the Apache service. Now you have successfully integrated PHP with Apache.
The above is the detailed content of How to compile and install Apache and PHP. For more information, please follow other related articles on the PHP Chinese website!