i

PHP Tutorial

Environment Setup

You can run PHP on various platforms, e.g. Windows, Linux, Unix, Mac OS X etc. and is compatible with almost all servers like Apache, IIS etc. PHP 7 is much faster and stable than all previous versions. PHP is very easy to setup. You need to download some files and set up the system for the first use. You can either find a web host with PHP and MySQL support or install a web server on your PC and then install PHP and MySQL.

> Installing PHP

1. Go to the site www.php.net -> Downloads -> Windows downloads.

2. You get a lot of options and then select the file best suitable for your operating system. For e.g., if you have the 64-bit operating system, select the VC14 x64 and similarly for a 32-bit system. Choose a thread-safe version and click on Zip file option.

3. The zip file will be downloaded, which will have all the required files to start using PHP. 

4. Extract all the files into some other folder.

>Configuring Window Path variable 

Window path variable configuration is required to let the system know that PHP is under which folder. As you will use all the functionalities of PHP, you need to ensure Windows is aware of it. 

1. Search the option 'Edit the system environmental variables' in the control panel. 

2. Click on the advanced tab and then choose environmental variables.

3. Go to the variable ‘Path’ click -> edit -> new -> Add PHP path.

4. Click Ok.

To ensure the path is added, go to command prompt and type echo%PATH% and if shows the PHP path, we have successfully updated the path variable. Then type PHP -v, and it shows you the version of PHP you are using. To start the PHP server type command php -S localhost:4000 and the development server will start.