Home>Article>Backend Development> How to install apache
PHP cannot run without the support of a server. What is a server? In layman's terms, a server software is installed on a computer. This computer can be called a server. The server software and the computer's own operating system are two different things. The computer's own operating system can be Linux, Unix, Windows or MacOS. At the same time, the service software can also be Apache (PHP), Tomcat (java/jsp), IIS (asp).
Recommended courses:PHP Tutorial.
PHP mainly uses the Apache server. The mainstream site construction combination is LAMP (Linux, Apache, MySQL, PHP). The integrated server software under Windows is WAMP (Windows , Apache, MySQL, PHP). In addition, there are some other PHP server software, such as lighttpd in Germany and nginx in Russia.
In my study, I mainly used the Apache server, so here I mainly talk about the download and installation of the Apache service.
(1)apache official website download Apache HTTP Server server
I believe that some friends want to download from the official website when they first use apache server, but facing the official website There are so many projects, images, and directories on the Internet that you may be a little confused. The following are the specific steps:
①Open the apache official website http://www.apache.org/
②Click Download in the upper right corner, the following interface will appear, here are the mirror servers, Just find one, the recommended version is used here.
③A directory list appears. These are apache's project lists. I don't understand why apache browses in this way. It's so ugly.
④Click "httpd", the following interface will appear
⑤Click the red box, the following interface will appear
⑥After entering the following interface , select the first item ApacheHaus, which is a third-party download platform. Downloading independent Apache from its website will be a compressed package. Among the other four, the second one is also an independent Apache download address, and the other three are integrated development environments. The first one I chose.
⑦In the new interface, you will find the words VC9 and VC11. By reading the relevant content, you know that VC9 refers to the code compiled with VS2008, while VC11 is compiled with VS2012, and VS2012 The compiled version cannot be used in Windows XP and Server 2003. For the sake of better compatibility, I chose 32-bit Apache compiled with VC9. I chose to download it here and the download process is complete!
(2) Installation of Apache server
After downloading the Apache server, decompress it.
1. Download the installation package
2. Unzip the file to the directory you want to place it. Here I choose to put it in D:\Apache- 2.4.20 directory.
Note: The name of Apache24 can be changed according to your own situation. I changed it to "Apache" as follows:
(3) Apache server configuration
Open the httpd.conf file (under D:\Apache-2.4.20\Apache\conf, this is mine. If the location is different, then The file location is different)
① Modify the directory location, as shown below:If your port 80 is occupied (you can use the command netstat under cmd -a view), change port 80 to something else and save it.
② Configure and install the main service of Apache. With it, Apache can be started. Open the cmd window and enter:"D:\Apache-2.4.20\Apache\bin\httpd.exe" -k install -n apache,remember to include the quotation marks. The meaning of this command is to install the apache service, name the service as apache (you can also change it to something else), and press Enter.
The service is installed. After completion, it will be automatically tested. If there is a problem, the window will prompt an error. At this time, please troubleshoot according to the error.
Normal installation is completed as shown below:
Among them, Errors reported here must be corrected before the service can be started. Meaning, report here Errors must be corrected before service begins. If not, success.
(4) Starting the Apache server
After configuring the Apache server, we can start the server. There are three ways to start the Apache server under Windows.
1. Start using Windows
Open Computer Management and find the apache service item. After selecting it, right-click to select the corresponding operation (start, stop, restart)
2. Start using the command line
I don’t know why I can’t start using the command line. The screenshot is as follows:
3. Use the Apache server Open your own window
Find ApacheMonitor.exe in the bin directory, open
Double-click to run, an icon will appear in the lower right corner of the desktop, double-click to open the window interface, You will see something like the picture below:
Click start on the left to start the apache service.
Supplementary sentence, it can be seen from this interface that it can manually control the opening and closing of the service. In order to save resources, when shutting down the Apache server, please click "Stop" to shut down the apache service. Of course, this service can also be turned off in Windows System Services (it is recommended to set it to manual).
The following picture shows the status of the service being successfully displayed:
Open the browser and enter http://localhost. If the following picture appears If the interface is displayed, the basic configuration of the Apache server is completed and the apache server is ready to run. More specific configurations need to be understood by the user.
The above is the detailed content of How to install apache. For more information, please follow other related articles on the PHP Chinese website!