1. PHP Installation Considerations

Before PHP installation, it is advised to understand the basic need and the requirements for a development environment as a particular dev environment may serve well for a specific task. Usually, PHP language is installed on a system to carry out the following tasks:

  • Web Development and Web Application Development
  • Command Line Scripting
  • Desktop Development or Desktop Applications

1.1. What are PHP Installation Requirements?

After determining the desired category of development, there is a need to identify that what are the requirements of PHP installation. There are three main requirements to configure PHP language, which includes:

  • PHP Itself Or Its Core Libraries Carry out the Interpretation
  • A web server or Web Hosting
  • An Operating system and a web browser are installed on it

Tutorial Contents:

  1. PHP Installation Considerations
  2. Installation of PHP Interpreter on Various Systems
  3. How to Install PHP on Windows OS?
  4. How to Manually Install PHP on Windows?
  5. Ultimate Guide to XAMPP Server Installation And Configuration

2. PHP Installation On Various Systems

Indeed, there are several ways to install PHP on operating systems. These may comprise of compile and configure method and pre-packaged method. Moreover, PHP installation has separate methods on different operating systems. Follow the links below to discover the installation methods provided by php.net.


Normally, PHP is already installed on macOS and Linux.

3. PHP Installation on Windows

Habitually, web developers install PHP on their operating systems to locally test their PHP code. The subsequent PHP tutorial illustrates the installation of PHP on the Windows operating system. Also, PHP installing software or PHP composer is available besides manual installation. Below are two ways to install PHP on windows:

  1. Manual Installation of PHP
  2. XAMPP or Any Other Server Installation

4. Manual Installation of PHP

Commonly, manual installation is not preferred because of its complicated process to install and configure. However, below is the method to install the PHP manually on the Windows operating system. Also, the subsequent tutorial comprehensively illustrates how to configure PHP 8 with an Apache server.

Steps Involved in manual PHP installation:

  1. Download PHP Package
  2. Extract the PHP Package
  3. Configure PHP Package
  4. Set Path Environment Variable
  5. Configure Apache Package
  6. Run PHP File

4.1. Download PHP Package

Firstly, download the newest version of PHP, i.e. PHP 8.2 from windows.php.net/downloads. Certainly, this package is a .zip or .rar file. Moreover, the version may be updated when you are installing it. Furthermore, make sure to download the thread-safe version. PHP Installation - Download PHP


If somehow, you downloaded the non-thread safe version, then there will be no php7apache2_4.dll file. Consequently, it will be unable to run the apache server with PHP.

4.2. Extract the PHP Package

Secondly, create a folder in your computer like C:\php7 i.e. in Local Disk C. Now, the Next step is to extract the downloaded PHP package inside this C:\php7 folder.

4.3. Configure PHP

Now, after extracting, configure PHP by copying all the text from C:\php7\php.ini-development file to C:\php7\php.ini file. After that, modify some lines of code inside php.ini, the newly created file.

Then, configure PHP by opening the php.ini file in a text editor and using search and replace for some modification.

i-Define Extension Directory

Next, locate for ; extension_dir = "./", remove the semi-colon ( ; ) and set the extension directory.

extension_dir = "C:\php7\ext"

ii-Enable Extensions

Now, search for the following extensions and remove the semi-colon ( ; ) before them. Importantly, the majority of the applications will run by enabling just these extensions.


iii-Configure PHP mail() Function

Moving further, enter the details of an SMTP server in order to configure the PHP mail() function. This will enable the PHP to send emails while in a local development environment.

  • Open the php.ini file
  • Locate the line that reads [mail function]
  • Further, make changes as directed below
[mail function]
; For Win32 only.
SMTP = mail.myisp.com /* Change this to your ISP */
smtp_port = 25; For Win32 only.
sendmail_from = my@emailaddress.com /* Change this to your email address */

4.4. Set Environment Variable

Usually, the path environment variable is set to ensure the working of PHP. Therefore, open system settings and set the path variable as below: System Properties Environment Variables Path Variable Set

4.5. Configure Apache Module

Firstly, download the Apache from apachelounge.com. Download Apache From ApacheLounge

Secondly, configure PHP as an apache module by following these steps:

i-Check Apache Installation

In the first place, make sure to check if apache is already installed by giving this command in the command prompt.

httpd -k start /* if it is installed already, it will run successfully. */

ii-Extract Apache Package

Now, extract the apache package and rename it to Apache24. Put this folder in C drive with the path as C:\Apache24.

iii-Configure Apache httpd File

Next, open the Apache directory and navigate to the conf folder. Open the httpd.conf file in a text editor and make the following modifications. Search for DirectoryIndex on line 239 and add index.php as the default file.

<IfModule dir_module>
DirectoryIndex index.php index.html

The next step is to set the ServerName by searching ServerName and modifying it as follows. Make sure to eliminate the hash #.


Eventually, go to the bottom of the httpd.conf file and add the below lines of code to finish the apache configuration.

# PHP7 module
LoadModule php7_module "C:/php7/php7apache2_4.dll"
AddHandler application/x-httpd-PHP .php
PHPiniDir "c:/php7"

iv-Install And Run Apache

The final step in the Apache configuration is to install it. Open the command prompt as Administrator and enter the below commands one by one.

// To change the directory to bin directory
cd C:\Apache\bin
// To install the service
httpd -k install
// To start the service
httpd -k start
// To stop the service
httpd -k stop

PHP Installation - Apache Installation Command Line

4.6. Run PHP File

  • Initially, locate the index.php file in C:\Apache24\htdocs\. If there is no index.php file, then create one
  • After that, open the file in a text editor, write some PHP code, and save it
  • Further, now open the browser and write in the search bar or localhost/index.php in the search bar
  • Finally, The browser will display the output of index.php
  • Congratulations!

5. XAMPP PHP Server Installation

XAMPP or LAMP or WAMP is a PHP composer or a pre-packaged software, that contains all the needed components to run PHP on a system. It only requires installing the package and database configuration as illustrated below for the XAMPP server:

5.1. How to Install XAMPP Server on Windows?

  • This is an easy and automatic process
  • Firstly, download the XAMPP server from sourceforge.net official website

PHP Installation - XAMPP Server Download

  • Secondly, the next step is to install the downloaded package by opening it
  • It will automatically install PHP, Apache Server, and database along with all the necessary settings
  • Further, now run the XAMPP server from the XAMPP shortcut icon on the desktop or start menu
  • Lastly, initiate the Apache and MySQL services only and you are good to go

XAMPP Server Running

5.2. How To Configure XAMPP and phpMyadmin on Windows?

  • Firstly, initiate the MySQL and Apache services from the XAMPP panel
  • Secondly, go to
  • In PHPMyAdmin, create a database with the appropriate name as below

XAMPP Server phpMyadmin Setup

  • XAMPP is all set up now and is ready to use
  • Just navigate to c:\xampp\htdocs\ and open the file index.php
  • Then, in the index.php file, write the PHP code and save it
  • Now open the URL address or localhost/index.php in the search bar
  • At last, the browser will display the output of index.php
  • Congratulations!

5.3. Popular PHP Local Servers

Apart from the XAMPP server, there are some other popular PHP servers for local development. You just need to download and install it on your system.

  1. XAMPP Server (Most Common)
  2. MAMP Server
  3. WAMP Server
  4. Local By Flywheel
  5. AMPPS Server
  6. EasyPHP DevServer


Give Us Your Feedback
If You Need Any Help!
Contact Us