Installation of PHP

Hello Guys . . .

Link Section
Apache    : https://www.apachelounge.com/download/
PHP         : http://windows.php.net/download/
MySQL   : https://dev.mysql.com/downloads/mysql/
VCRedist : https://www.microsoft.com/en-us/download/details.aspx?id=53587

Note : Don't just see the name of things to be downloaded. Read it completely.

Download Section


1) VCRedist 2015
Click the above link. If by any chance the link fails, Google it. It's boring to say the same thing again and again. Once you click the download button, you will be prompted to choose x-64 or x-86.



2) Apache
Click the above link. If by any chance the link fails, Google it.
Download the appropriate version based on your OS(64-bit or 32-bit).

3) PHP
Click the above link. If by any chance the link fails, Google it.
Download php5 which is suitable for your OS(64-bit or 32-bit) and Thread-Safe. Download the Zip pack of the correct version.


4) MySQL
Click the above link. If by any chance the link fails, Google it.
Check the Recommended Download and download the MSI(installed packages) installer for MySQL.
In the following page, download Generally Available(GA) release of  appropriate version. Download the Offline version (large file). If you have a doubt whether its ok to download 32-bit version, check the note mentioned there.


This completes the Download Section.

Installations and Extractions


***Run the setup for VCRedist.

***Extract the downloaded Apache(httpd) zip. You will get a folder and two other files. We don't need the other two. Copy the Apache folder you got from extraction to your System Drive.

***Extract the download php Zip to a folder named "php"(without quotes) and copy the folder into your System Drive.

***Run the MySQL setup and continue normally.(In between you have to set a password for your MySQL. Follow the picture-wise instructions postedbelow)








Final Steps

Step 1) Installing Apache HTTP Server

Open Command Prompt (CMD) as Administrator. Type the following and press enter.

c:\apache24\bin\httpd -k install

It may ask for a firewall permission. Allow Access for it.

Step 2) Changing the Apache configuration file

Open the httpd.conf file in a text-editor(Notepad, Notepad++, Atom etc.) present in the conf folder of Apache folder which you copied into System Drive.
Note : Here "C" is my System Drive. So i used "c" here

*) Find "DirectoryIndex" in the file. Replace index.html with index.php (This checks if there is a file named "index.php" and opens it when we type localhost as our URL).

*) Find "ServerName" in the file. Replace www.example.com:80 with localhost


*) Go to the ending of the file and paste the following code there.

#Loads the php module to apache
LoadModule php5_module "c:/php/php5apache2_4.dll"
#Adds a handler for php files
AddHandler application/x-httpd-php .php
# configuration of php directory
PHPIniDir "C:/php"


(Do remember that all changes have to be done in httpd.conf file)

After making these changes again go to the directory of Apache24/bin/ in CMD as a administrator and type "httpd -k restart" without quotes and hit enter. This restarts the apache server so that the changes are applied.

Step 3) Setting Path Variables

Open the Environment Variables from Advanced Setting of your PC and edit the variable Path and add the following values :

C:\apache24\bin\
C:\php\
Note that these two locations are as per my System drive C. Change it to suit your path

Step 4) Editing the php.ini file.

Actually you won't find this directly in your php folder. You have to rename php.ini-development to php.ini.

Find extension_dir in the file. Uncomment it by removing the semi-colon(;) before it.
Find php_mysql.dll. Uncomment it by removing the semi-colon(;) before it.

This successfully completes installation of PHP in your system.

Testing
The default path for the files of localhost is C:\Apache24\htdocs
*******************************************************************
To run localhost from a specific location do this.
Change directory to that specific location and type the following command and press enter.

php -S localhost:8080 (8080 is the port number).

If there is a file (index.php) in the path where you are in cmd, it will be loaded first because we mentioned apache to open the file index.php instead of index.html
********************************************************************

Comments

Popular posts from this blog

GCP-Tensorflow- Install Tensorflow-GPU with CUDA 8.0 and cuDNN 6

Auto Shutdown

Must Need ANDROID apps.....