How to install PHP 7.4 on windows 10

Beno Developer
5 min readSep 8, 2022

In this article, We were going to demonstrate how to install PHP 7.4 on Windows 10.

How To install PHP 7.4 on windows 10
Image by rawpixel.com on Freepik

Users of Linux and macOS often have Apache and PHP pre-installed or can get them via package managers, Windows 10 necessitates a bit more work.

Note: Other Windows and PHP editions could also work with the following instructions.

But first, a reminder about PHP, what it is for, and what you can do with it.

What is PHP?

PHP is a server-side programming language developed by Rasmus Lerdorf in 1994. It stands for Hypertext Preprocessor, which formerly stood for Personal Home Pages.

PHP applications can only be run on servers that have PHP installed.

PHP files include PHP tags and are terminated with the extension “.php”.

PHP is an interpreted scripting language, that executes instructions directly, without compiling into machine-language instructions. It translates the program by going through line by line and executing each instruction individually.

What can PHP do?

PHP is primarily focused on server-side scripting, so you can gather form inputs, produce dynamic page content, and send and receive cookies just like any other CGI application. However, PHP is capable of much more.

There are three main areas where PHP scripts are used:

Server-side scripting.

This is PHP’s most conventional and primary target field. To make this work, you’ll need three things: a PHP parser (CGI or server module), a web server, and a web browser, install and run a local or hosted server with PHP pre-installed, then by using your favorite web browser, execute your PHP program output by visiting the PHP page.

Command line scripting.

You may execute it without a server or browser by writing a PHP script. This method simply requires the PHP parser. This form of usage is appropriate for scripts that are run regularly using corn (on *nix or Linux) or Task Scheduler (on Windows).

Writing desktop applications.

PHP is not the greatest language for writing a desktop application with a graphical user interface, but if you know PHP well and want to leverage certain sophisticated PHP capabilities in your client-side apps, you may construct such programs with PHP-GTK. This also allows you to create cross-platform applications. PHP-GTK is a PHP extension that is not included in the standard distribution.

How to Install PHP

Follow the instructions below to install PHP. there are various ways to configure PHP, but this is probably the quickest.

  • Download the PHP files.

All you need is the zipped PHP Windows installation file.

To get it, go to https://windows.php.net/download.

you will find several PHP versions available; depending on your Windows Architecture, check for PHP 7.4 Thread Safe (x64 or x86).

Click ZIP to download the zip file.

Check whether a Windows computer is running 32-bit OS or of 64-bit one. Launch CMD and type the following command: wmic OS get OSArchitecture.

  • Extract the files.

Create a new folder in your C:\ drive named php, then unzip the zip file and copy the entire contents into the newly formed folder C:\php.

PHP can be installed anywhere on your system, however, the locations listed below will need to be changed if C:\php is not utilized.

  • Configure php.ini.

Open the folder and search for a file that contains php.ini; you will find two files, php.ini-development and php.ini-production.

Thephp.ini-development configuration file offers a development setup that reports all PHP errors and warnings.

Rename the php.ini-development to php.ini, Open it with your favorite text editor, and you will notice many lines with semicolons (;) at the beginning.

First, enable any necessary extensions. This will be determined by the libraries you want to use, however, the following additions should be enough for the majority of applications:

uncomment these lines by removing the semicolons at the beginning of the line:

curl: allows you to send and receive files over HTTP and FTP.

gd: The PHP GD Graphics Library is a graphics software library for dynamically manipulating images.

mbstring: provides multibyte-specific string functions that help us deal with multibyte encodings in PHP.

pdo_mysql: is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL databases.

  • Add C:\php to the path environment variable.

Now comes the final phase, To guarantee that Windows can find the PHP executable, modify the PATH environment variable.

Type “environment” into the Windows Start menu, then click Edit the system environment variables. Click the Environment Variables button on the Advanced tab.

Scroll down the list of System variables and select Path, then the Edit button.

Add C:\phpby clicking New.

When everything has finished, start a new command prompt instance and execute php -v.

If there are no errors, the prompt will display the current version of PHP.

If you have any questions, you can reach me @beno_developer.

--

--