How to set PHP environment on Windows 10 and 11

Andrei Birta
3 min readDec 26, 2022

--

First of all we will start with a BIG question :)

Why PHP ?

PHP ( Hypertext Preprocessor) is a widely used scripting language that may be used to create dynamic and interactive webpages. Being one of the first server-side languages that could be included into HTML, it made it simpler to add functionality to web sites without having to contact outside files for information.

Start with PHP on local machine (small tips)
When you decide to start with PHP, you can start to develop different application or websites on your PC without affecting your live systems or data and also you can try to test whatever you want.

How to install PHP
Here we have a lot of ways of how doing this, but maybe this is the quickest method.

1. Download the PHP installer files from https://www.php.net/downloads.php. There you can pick which version you want.
2. Extract the file.
3. Create new folder “php” and put the files on the “C:/”
4. PHP’s configuration file is named php.ini.
This doesn’t exist initially, so copy C:\php\php.ini-development to C:\php\php.ini. This default configuration provides a development setup which reports all PHP errors and warnings.
In the php.ini you will have some lines which are commented out (;) some of that lines are extension of PHP which maybe you will need to use in the future, so remove that semicolon for which you will need to use (is you know) but for the beginning check for this to be there (most of the PHP applications will need them):
extension=curl
extension=gd
extension=mbstring
extension=pdo_mysql

5. Add “C:\php” to the path environment variable.
To make sure that Windows can find the PHP executable, you need to change the PATH environment variable.
Click the Windows Start button and type “environment”, then click Edit the system environment variables. Select the Advanced tab, then click the Environment Variables button.
Scroll down the System variables list and click to the Path and after that to the Edit button. Click New and add “C:\php”.

Windows Environment Variables System

6. Check if PHP was properly installed on your computer.
To make sure you have done everything correctly, restart your PC, then open a Command Prompt and run the command “php -v”. It will display the version of PHP you have set.

Check PHP version on Command Line

Get more valuable insights and tips by following me!
Also check my list of articles about the PHP or different type of architecture.

--

--