Following are the key steps/points described later in this article:
- Install Apache 2.4
- Install PHP 5.6
- Configure Apache 2.4 for PHP
- Configure PHP 5.6
Install Apache 2.4
This step looks to be obvious. However, after I am done with the entire installation, it looked to be a bit tricky especially when you got 64-bit Windows. If you go to website, http://httpd.apache.org, you are taken to download page for win32 binaries. If you have 32-bit machine, well and good.
However, if you have 64-bit machine, and you downloaded the install-able from this page, you would end up installing 32-bit apache server which would create issues while configuring 64-bit PHP. What you need is 64-bit Apache 2.4.2 Http server. There are different pages on web from where you could get it. I downloaded it from Apache HTTP Server 2.4.2 x86 and x64 Windows Installers. Take the first one, apache_2.4.2-x64-openssl-1.0.1c.msi (Mirror 1) (Mirror 2).
Install PHP 5.6
For PHP 5.6 version, go to Windows Binaries page and you would see binaries, thread-safe or non-thread safe for both 32-bit and 64-bit WIN platform. As this article is about 64-bit, go ahead and download zip file user “VC11 x64 Thread Safe”.
Once downloaded, unzip it and place it in appropriate folder within C:\ or D:\ directory.
Configure Apache 2.4 for PHP
So far so good. It’s time to configure Apache Http Server. Even before you configure, open a command prompt, go to <Apache Root>/bin and start the server by executing httpd command. If it starts without issue, access http://localhost:8080 and it should display a page saying “It works!”. Add the following command at the end of httpd.conf file which could be found within <Apache Root>/conf folder. Following command assumes that PHP is installed within D:/php
LoadModule php5_module "D:/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php # configure the path to php.ini PHPIniDir "D:/php"
In addition to above, go ahead and add index.php to DirectoryIndex variable in following manner:
<IfModule dir_module> DirectoryIndex index.php index.html </IfModule>
Configure PHP 5.6
You are just one step away. Go to <Apache Root> folder and save php.ini-development as php.ini file. Uncomment extension_dir = “ext”. Go ahead and uncomment one or more extensions that you would like to be loaded. For example, extension = php_mysql.dll, extension = php_mysqli.dll etc.
Test the Installation
You are all set!!! Go to <Apache Root>/htdocs folder and create an index.php file. Write following code in that file. Open a browser and access http://localhost:8080. You should be able to see Hello World!!! printed with bold letters.
<?php echo "Hello World!!!"; ?>
- Book: First principles thinking for building winning products - April 19, 2022
- Free AI / Machine Learning Courses at Alison.com - November 16, 2021
- 12 Weeks Free course on AI: Knowledge Representation & Reasoning (IIT Madras) - November 14, 2021