• Calculating...
  • 3 years ago
  • 2K Views
  • Archived This is an Archived post.
    The content within this may not be used or replaced with newer versions.

Installing PHP on Windows

What is PHP?

PHP is known to be one of the most commonly used server-side programming language on the web. It provides an easy to master with a simple learning curve. It has close ties with the MySQL database, and various libraries to cut your development time.

Two Ways to install PHP locally.

 

There are several ways that we could install PHP locally. Here i have added two of the most common ways to install PHP as shown below.

  1. Installing a Web Server (XAMPP, WAMP etc)
  2. Implementing via PHP Installer

Installing a Web Server

There are many all-in-one packages are available for Windows and other OS’s which comes with Apache, PHP, MySQL and other applications as a single file installer, e.g. XAMPPWampServerMAMP etc. There is no any issue in going with these packages, however manually installing Apache and PHP will help you to have more control and access to its configuration options.

 

 

 

 

Implementing via PHP Installer

It provides several benefits for backing up, reinstalling, or moving the web server can be executed easily in a short amount of time and it provides more control over PHP and Apache configuration. In the Manual Installation, you need to configure several steps in order to install PHP successfully.

 

STEP 1 : DOWNLOAD THE PHP PACKAGE & EXTRACT THE FILES

Get the PHP version 8.0 or later (x64 Thread Safe) package zip file via navigating under the windows downloads URL mentioned in the link below.

 

https://www.php.net/downloads.php.

 

After, downloading the zip successfully to your PC, create a folder as “PHP” in any drive and extract the PHP package files into it.

 

STEP 2 : CONFIGURE PHP

Initially php.ini file doesn’t exist inside the php package files. so copy {drive_name}:\php\php.ini-development and rename it as {drive_name}:\php\php.ini whereas the default configuration provides a development setup.

To uncomment a setting inside the php.ini file you need to remove a leading semicolon (;). Uncomment the following lines to enable the required extensions whereas the following extensions are mostly required by many PHP frameworks and for other operations.

 
extension=curl
extension=gd
extension=mbstring
extension=pdo_mysql

STEP 3 : ADD PHP TO THE ENVIRONMENT VARIABLE

To access PHP globally at your PC add the PHP package path by following the steps below.

  • Step 1: Click the Windows Start button and type “environment”.
  • Step 2: Click Edit the system environment variables. Select the Advanced tab, and click the Environment Variables button.
  • Step 3: Scroll down the System variables list and click Path followed by the Edit button.
  • Step 4 : Click New and add {drive_name}:\php:

 

NOTE:
You are not required to reboot the PC, but you may need to close and restart any cmd terminals if you have opened before.

 

STEP 4 : TEST A PHP FILE

Create a new file named index.php and add the following lines of codes and save it.

 
<?php
  phpinfo();
?>
 

Run the PHP file by entering the following command in CMD where you have created the index.php file.

php index.php
 
Share:

Related Post

Convert PHP Array To JSON : Examples

This tutorial focuses on converting PHP Array to JSON. It is used to read data from the server and display it to the Web. JSON is a text format , and We can convert any JS Object into a JSON format.

  • 5 years ago

Simple PHP Page Router

This is a simple yet basic PHP routing application created to direct all request to index.php and route the files to it’s relevant paths.

  • 5 years ago

Simple PHP MySQL CRUD Application

PHP is widely used by many developers today and it’s one of the easiest language to learn. This tutorial will help you to learn the basic CRUD (Create, Read, Update, Delete) operations.

  • 5 years ago

PHP Program to remove empty or specific array elements

This tutorial is created to remove specific or empty (NULL) array elements from the array.

  • 5 years ago

PHP Array Functions and their usage with examples

This tutorial is created to give an abstract idea about commonly used PHP array function with examples. Through this tutorial you’ll be able to know, how to use array functions to make code more short

  • 4 years ago