How To Install Apache, PHP and MySQL Manually On Windows

Apache PHP MySQL, Web Server

If you are a web developer, using Apache, PHP and MySQL is the most easiest way you can do. You can start your website stuff in just few minutes. If you are using windows, there's program called XAMPP, it gives you a bundle of Apache, PHP and MySQL altogether, by just following Next and Next button, you can start your web development journey right away.

But if you want have lot of control over your Server stack, you can do install manually. By installing them separately, you can switch between version of Apache and PHP much more easier. So here's how you can server stack for your web development manually.

Before you start the steps, it is important that you need to have Visual C++ (VC) run time exactly the same for your PHP binary build, and Apache binary build, the newest VC ++ is version 15,17,19.

1. Download the VC run time 15,17 and 19

From this link: https://aka.ms/vs/16/release/vc_redist.x64.exe

Visual C++ 2015, 2017 and 2019 is compatible with each other. Unlike the previous version, if want the Apache and PHP built using lower than VC 15, you should have install the corespondent VC run time on your computer, exactly the same for each Apache and PHP.

2. Download Apache VC 15

Link here: https://home.apache.org/~steffenal/VC15/binaries/httpd-2.4.41-win64-VC15.zip

3. Download PHP VC 15

Link here : https://windows.php.net/downloads/releases/php-7.3.9-nts-Win32-VC15-x64.zip

4. Unzip all the Apache and PHP

I usually make a new folder called "Apache-PHP-Vc15" and unzip both Apache and PHP inside that new folder, both inside the same folder.

5. Test if the Apache can be run on your machine
You can open ApacheMonitor.exe, on that you can start, stop or restart the apahce. If it is running, you can check on your browser by visiting http://localhost

6. Test if PHP is doing good
Open windows cmd, locate to you PHP Extraction directory, for example mine is:

cd D:\Apache-PHP-Vc15\php-7.3.9-nts-Win32-VC15-x64\bin

Just using this command to see if your PHP is working with no error:

php -r "echo \"It is working!\";"

7. Make Apache loads PHP
Using any kind of text editor, open Apache configuration which is httpd.conf inside YOUR_APACHE_LOCATION/conf/ and then add the following line on the very bottom of that file:

LoadModule php5_module "D:/program/apache-php-vc11/php-5.6.40-Win32-VC11-x64/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "D:/program/apache-php-vc11/php-5.6.40-Win32-VC11-x64/"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

And then still in the file, search for this section:

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

And and index.php like this:

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

8. Now restart the Apache using ApacheMonitor.exe
9. To test if any PHP files can be loaded
You can create a test.php file and put this line:

<?php phpinfo() ?>

10. Final Test
Using your favorite browser visit that at localhost/test.php, if you can be able to see a phpinfo page, it means that your Apache and PHP integration is being succeed.

Aditional Thing


11. Install MySQL
It is easy to link between PHP and MySQL, you can just open php.ini using editor, if there's no php.ini, you can just rename php.ini-development. And then locate to :

;extension=php_mysqli.dll

Just remove the semicolon in front of it, save and then restart the Apache httpd server.




Comments

Popular posts from this blog

Flixify Video Streaming Platform

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

Push Notification Cordova, FCM And PHP