Install PHP

Install PHP

There are two methods written in this article to install PHP in your system or laptop.

  1. Manual 
  2. Automatic

Before installation of PHP you, have to decide which PHP Version you need to install.

Steps To Install PHP Manually

Download the Language PHP files (zip) from the official website “www.php.net/downloads.php”. Link: DOWNLOAD PHP

Install PHP in “C Drive” C->folder_name or C->php make folder then extract downloaded zip file into it.

One most important thing is PHP is installed anywhere in the system/laptop but you must need to change its path “PHP Referenced“.

Now you have to configure php.ini file Copy C:phpphp.ini-development to C:phpphp.ini.  There are also many other changes you need to change so open file in the text editor (notepad, notepad++ recommended) and also remove semi-colons on the lines.

Define Extension direction:    extension_dir = "C:/php/ext"

Then there's some libraries that you are going to use in your website's or web applications need to be enabled-libraries. Following libraries somehow compulsory for mostly project: 

extension=curl
extension=gd2
extension=mbstring
extension=mysql
extension=pdo_mysql
extension=xmlrpc

Now ensure window to find the PHP in system you need to change/add the environment variable C:php.

Goto setting search for “environment variables” then in the result you see “Advanced” tab, click on the “Environment Variables” button.

Scroll down slightly “System variables list” click on the “Edit text” and add ;C:php at the end of the variable value line.

Reboot Your System Then.

Configure PHP as an apache so for this, you need to stop apache.

 Open its(apache) confhttpd.conf file you need to configure it add some lines given below:

Goto 239 line, add index.php as a default file name:

DirectoryIndex index.php index.html
Then at the end of file add these lines(to change the file location if necessary)
# PHP5 module
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

Save the file and close it and test it from command line (press window button + r) type "cmd" and press ok button.

cd Apache2bin
httpd -t

TEST A PHP SCRIPT AND CHECK its WORKING OR NOT.

Create a file named as index.php in the apache’s root folder ( htdocs or D:WebPages ) add this code of PHP to CHECK PHP INSTALLED VERSION 

<?php
// prints e.g. ‘Current PHP version’
echo ‘Current PHP version: ‘ . phpversion();

?>

Check twice that apache is working/running then open browser and type http://localhost/ in the browser search bar if everthing is settle good you see the installed version of PHP and other configuration.

 AUTOMATIC-METHOD

For this method, you just have to download one of the below mention softwares.

WAMP (for windows) 

XAMPP (for windows)

LAMPP (for mac)

MAMP (for mac)

these softwares are free and open source takecare of all these  (php / apache / mysql / etc) modules and  commercial software use to run dynamic websites.

If your OS is 32 bit you have to download the 32 bit version.

If your OS is 64 bit you have to download the 64 bit version.