Install Apache2.4 on Windows systems and configure with php

By CodersDrive
15-Jun-2020
Apache
Php

By following this you will be able to install apache2.4 server on windows machines and configure it to work with PHP.

Install apache2.4 server on Windows systems
Step-1 Download Apache2.4

Download the required version of Apache from here. Here we consider of installing Apache 2.4.43 x64 with OpenSSL support. This link will download a ".zip" file. Before installing this package make sure you have installed the Visual C++ 2015 redistributable from here

Step-2 Install Apache2.4

Installation here means just extract the downloaded "zip" file to C:\Apache24 folder. Now we have to register the apache2 to windows services to start automatically when windows starts.

For this open the "Command Prompt" as Administartor and run the following Commands.

C:\Windows\System32>cd C:\Apache24\bin
C:\Apache24\bin>httpd.exe -k install

You will get 'The "Apache2.4" service is successfully installed' message means you have configured Apache2.4 service correctly on your windows machine.

Now open your browser and enter url as http://localhost, you will see a message "It Works!" means your Apache2.4 server is configured correctly and accepting requests also.

Install apache2.4 on Windows

From now onwards Apache2.4 service will start automatically with windows. You can manage this service by going to "services.msc" via "Run"

(press " + R" to access Run)
Step-3 Configure Apache2.4 to work with PHP

To continue this step, you should have installed PHP on your system. If not done yet do it by following the below link.

Now open the httpd.conf file from C:\Apache24\conf add the following lines at the end of file.

LoadModule php7_module "C:/php7.3/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir C:/php7.3

Please observe C:\php7.3 is the path where PHP is already installed, change this location as per your PHP installed location. Now save this file and restart the "Apache2.4" service by accessing from "services.msc".

Step-4 Test PHP working with Apache2.4

From now onwards Apache2.4 server can parse ".php" files. To test its working let's create a test file info.php and save at the server document root path C:\Apache24\htdocs. Add the following line to this file and save it.

<?php phpinfo(); ?>

Now open your browser and enter the url "http://localhost/info.php". You should be able to see the following page showing the PHP configuration installed on your system.

php installation on windows

If you could able to get it, congratulations! you have successfully installed and configured PHP and Apache2.4.


Apache Php Windows

Search blog..!

Connect with us