Install PHP on Windows

Here are two methods to install php in window is given below

  • Using XAMPP
  • Using PHP Files

Using XAMPP

Download xampp exe in window and install software using this software php will automatically install in your computer and you can check php is installed or not using the command line

Press Window Key +R and then run box open and then type cmd in run box input and then command line is open.

Type php -version in terminal

C:\Users\exampot>php -version

Output

C:\Users\exampot>php -version
PHP 7.4.7 (cli) (built: Jun  9 2020 13:36:15) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Using PHP Files

You can download php file from the official https://www.php.net/downloads website and then download php for windows.

Step 1: Get the PHP files and extract them

Extract PHP files in the  C:\Program Files Folder.

Step 2: Configure the php.ini

php.ini is the PHP configuration file which indicates the behavior of your PHP. php.ini is the file you need to edit if you need some custom configurations.

You would open the php.ini with the editor and search ;extension=pdo_mysql 

you should be remove the leading semicolon (;) and Press CTRL+S for save the file.

Step 3: Add PHP to the PATH environment variable

  • "Edit the system environment variables" search in window search box in your computer
  • Select the "Advanced" tab and click "Environment variables...".
  • Find the PATH variable in "System variables" box and then select it, and then click "Edit".
  • Click the "Browse..." button and Click NEW button and add php directory where php files located.
  • Click OK until you’re out.
  • Type php -version in terminal for checking is php installed succesfully.
C:\Users\exampot>php -version