HOW TO Install PHP on Your Server

This tutorial will go over the setup process of installing PHP on your server. It is designed to walk you through the process step by step with ease. Even if you have never done anything with PHP before, you should be able to follow these instructions to install PHP on your server. Installation of PHP on your server lets you run WordPress and other platforms successfully. In case you go wrong or lose data on your server, you can contact Data Recovery Hospital for server data recovery.

Download and Install

The first thing you will need to do is download and install PHP from http://www.php.net/downloads.php . Make sure you get the latest version, as there may be crucial updates available. Now you will need to Unzip PHP. For example, you could unzip to your C drive, as this would be the option presented by default. Now rename the following file: C:phpphp.ini-dist it to php.ini

Editing the php.ini file

Next you will need to edit the PHP.INI file to the proper customization for your server.

Start by opening php.ini in a text editor and then scroll down approximately halfway through the file and find the spot that says doc_root and change it to point to whatever your Apache DocumentRoot is set to. In my case: doc_root = “C:public_html”

Now scroll down approximately seven more lines and change the extension_dir from extension_dir = “./” to the location of the extension directory after you unzipped PHP. in my case: extension_dir = “C:phpext”

If you will be using your server for testing, I would suggest you find and adjust the error reporting to give you info on any notices, errors, or incorrect coding. If you want to enable these kind of features, simply search for error_reporting and then make the following change:

error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT

to

error_reporting = E_ALL | E_NOTICE | E_STRICT

Editing the Apache config file

Now open httpd.conf with your text editor, and either at the very end or the very beginning of the file add the following lines:

LoadModule php5_module “C:/php/php5apache2_2.dll”

AddType application/x-httpd-php .php

PHPIniDir “C:/php”

(NOTE: make sure you change BOTH of the C:/php parts to the directory you installed your php to)

To make apache automatically search for an index.php, search httpd.conf for DirectoryIndex ( should be near line 210) and add the files you want apache to look for when a directory is loaded. An example would look like:

<IfModule dir_module>

DirectoryIndex index.php index.html default.html

</IfModule>

Test

The final step is for you to test the results of your hard work.

First, restart Apache if it is already running. If for some reason it does not start or you see error messages, then use the Apache Test Configuration shortcut in the Start Menu to find out why you are getting errors.

Now to test your PHP all you need to do is create a test.php file in your Apache DocumentRoot folder. Type the following three lines in your test.php file, and then load the test file in your browser in this fashion: “http://localhost/123.php” ( using the following three lines you should get a whole long list of php settings, variables, etc):

<?php

phpinfo();

?>

If your test was successful, then congratulations you have successfully installed PHP on your server! If not, then do an un-install and go back and follow these instructions again more thoroughly. Good Luck!

Author bio:

This post was presented to you by www.tech-faq.com the home tech nerds. Here you can find anything technology related, ranging from Cisco’s 3 layer hierarchical model to Windows 8 tips.

  • Shurie

    Hey Loved the post! Great article. Its a big help to those programmers or web developers. I will be back to visit often.Thank you for sharing.