o.css">

Cris's Projects

Links

Home


Visitors IP :

Programs and Tutorials

HTML

MineCraft

Visual Basic

'C' Programing

MS DOS

Commodore 64

Raspberry Pi

3D Printing

Misc

Installing PHP for Apache in Windows 10

This is a basic tutorial on how to install PHP for Apache web server software in Windows 10.

Please read tutorial start to finish before proceeding

Step 1) Download PHP files -

A) Navigate to "https://www.php.net/downloads.php", on this page click on the "Windows downloads" link.

B) On this page you are looking for the "Thread Safe" version for either the X86 or x64 depending on if you are running Apache x86 or x64.

C) Download the Zip file.

PHP_Download1 PHP_Download2 PHP_Download3

Step 2) Install PHP -

A) Create a new folder called "php", I put the folder in my root directory along side my "Apache24" folder. eg "C:\php"

B) Open the Apache configutation folder eg "C:\Apache24\conf" and then open the "httpd.conf" with a text editor like notepad.  WARNING!!! It is a good practice to back up this file or any .conf file before modyifying.

C) Add these lines to the very beginning of the file -

           LoadModule php7_module "c:/php/php7apache2_4.dll"
          PHPIniDir "c:/php"
          AddHandler application/x-httpd-php .php
          AddType application/x-httpd-php .php .html

!!!Update!!! For Version 8 then first line should be :"
          LoadModule php_module "c:/php/php8apache2_4.dll"
I haven't had a lot of luck with Version 8 yet so will fix up tutorial once i work it out.

The paths in the first and second line should reflect where you placed the "php" folder.

Step 3) Restart the server -

A) To restart the server if you have the shortcut I recomended in my install apache tutorial click on the shortcut then skip to step E.

B) Type "cmd" into the search bar, then click run as administrator.  Aggree to the UAC warning.

C) In the Command Prompt change to the root directory using "cd\"

D) Then type "cd Apache24\bin" without the quotes.  - This is if your Apache is located at "C\Apache24)

E) Then type "httpd -k restart".  This will restart the Apache server so the changes to the .conf file take effect.

PNP_Restart

Step 4) Test PHP is working -

A) Open up the "C:/Apache24/htdocs" folder and create a text file.  Rename the text file to "php-info.php".  If you dont get "If you change filename extention, the file might become unusable" warning then you need to make file name extentions visable.

B) Open the file with a text editor such as notepad and paste the following lines into it and save the file -

           <?php
          phpinfo();
          ?>

C) On a device that is connected to the same network as the Apache PC is connected to open up a web browser and type in the Apache PC's IP address into the address bar along with "/php-info.php".  eg- "192.168.0.###/php-info.php"

D) Press enter and the PHP information page should load.

PNP_Info2

WARNING!!!  You do all of this at your own risk.  I will not be responsible for any hardware/software damages that may occour from following this tutorial, Please back things up frequently and all will be fine...