How to install php 8 on windows 7

Abel Lifaefi Mbula

Imagine that you’ve just bought a new computer and want to quickly execute PHP commands. Although I work with Docker, I sometimes need to run some PHP commands or work with composer outside the containers. Therefore, it is always a good idea to have PHP installed on our machine.

If you have learned about LAMP stack, then you will know PHP is the last layer in this stack.

What we will cover

In this shot, we will go through the following three steps to install PHP 8 on windows:

  • Step 1: Get the PHP files and extract them.
  • Step 2: Configure the php.ini.
  • Step 3: Add PHP to the path environment variable.

Step 1: Get the PHP files and extract them

First thing first, you need to download PHP files. Go to this site, choose your PHP version (PHP 8 for us), and download the provided zip file.

Next, we will extract the zip file to C:\Program Files.

How to install php 8 on windows 7

PHP 8 on Windows

Note: I’ve put my PHP files under Program Files, but feel free to put them anywhere you want. Some might prefer to store their files under C:\.

Step 2: Configure the php.ini

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

Let’s suppose you want to use the pdo_mysql extension in your program. You would, open the php.ini with the editor of your choice and browse the file until you find the line ;extension=pdo_mysql.

To enable this extension, you just need to remove the leading semicolon (;). This can also be referred to as uncommenting the directive.

After you are done with the modification, save and close the file.

Note:

  • To quickly browse the php.ini file, you may need to do a quick search with Ctrl + F.
  • If it happens that the php.ini file is missing, you can copy php.ini-development to php.ini.

Step 3: Add PHP to the PATH environment variable

Last but not least, we want to be able to use PHP anywhere from the CLI.

Let’s first learn about environment variables:

Environment variables store various values related to the current environment, like the operating system or the user session. One of the most well-known environment variables is PATH, which specifies the directories in which executable programs are located on the machine that can be started, without knowing, and typing the whole path to the file on the command line.

Now that we know what an environment variable is, let’s add our PHP directory to the PATH variable. To do so:

  • Hold down the Windows button, type environment, and open "Edit the system environment variables".
  • Select the "Advanced" tab (if this has not yet been done) and click "Environment variables...".
  • Find the PATH variable under "System variables", select it, and then click "Edit".
  • Click the "Browse..." button and select your PHP directory.
  • Click OK until you’re out.

How to install php 8 on windows 7

Edit Path environment variable

Now, let’s test our installation. Open the CMD and type,

php --version

You should see some info about your installed PHP like the image below.

How to install php 8 on windows 7

PHP version on CLI

Congratulations! You’ve successfully installed PHP.

Happy coding.

RELATED TAGS

php

windows

web development

communitycreator

CONTRIBUTOR

Abel Lifaefi Mbula

Does Windows 7 support php8?

Download and install PHP 8 If you are using Windows 7, 8, 8.1, 10, 11, 2008, 2012, 2016, 2019, or later on a 64-bit OS, download the preconfigured PHP 8.1. 7 package (64-bit) for Windows. If you are using Windows 7, 8, 8.1, 10, 2008 or later on a 32-bit OS, download the preconfigured PHP 8.1.

Can we run PHP in Windows 7?

Here is how to install and run PHP on Microsoft Windows 7, 8 and 10: Download the latest XAMPP from apachefriends.org. Install the XAMPP using the setup wizard. After installing XAMPP go to the default directory.

How do I install PHP on Windows 8?

In this shot, we will go through the following three steps to install PHP 8 on windows:.
Step 1: Get the PHP files and extract them..
Step 2: Configure the php. ini ..
Step 3: Add PHP to the path environment variable..

How do I download PHP for Windows 7 64 bit?

Download latest version of PHP from http://www.php.net/downloads.php. Prerequisite and running on your Windows system, else you will not be able to run PHP Scripts. Alternatively, you can install WAMP server or AMPPS server to install PHP, MySQL, and Apache Web Server on your Windows machine.