We introduced PHP to students in the Part 1 of this tutorial. In order to run PHP locally or in your computer or laptop you will need following resources:
Note – Nginx (high-performance HTTP server), lightspeed (open-source web server) etc. are some alternatives to Apache.
You can download php from www.php.net/downloads
Needed to Create and Test Databases.
These three resources must be present in your computer in order to run and test PHP code.
PHP can run on any operating system from Microsoft, Linux and Mac-OS if you have necessary resources installed.
If you don’t want to install php manually you can use a simple tool that will install APACHE, PHP, PERL and MYSQL in your computer.
You will need Web Browser like Google Chrome or Mozilla to run your web pages.
We suggest you to use any of the following tools to Install Server for PHP and MySql in your PC or laptop:
XAMPP is commonly used for running PHP websites in local server but AMPPS is also as efficient as XAMPP.
These tools will install all resources needed to run PHP in Local Server.
After Installing XAMPP you will get a folder in your default drive (or chosen drive while installing) named XAMPP.
Inside XAMPP folder you will find configuration files for all resources which you can see in this image.
Inside the XAMPP folder you will see HTDOCS folder. This HTDOCS folder is the root folder of your local website hosting.
Directories created within HTDOCS folder will represent new Websites.
For Example: If you will create a directory named SLIDESCOPE in your HTDOCS folder then inside the SLIDESCOPE named folder you will put your web pages and files.
After Installing XAMPP you will find XAMPP CONTROL PANEL in your computer. It looks like this:
Yu can see that it is showing the Operating System Details and the status of APACHE and MYSQL server.
In order to run PHP and MySql you have to start the APACHE and MySQL in control panel.