Installing PHP

There are different ways to install all the required software. We can install components separately, or we can use ready-made assemblies like EasyPHP. In such assemblies, the components already have the initial configuration and are ready to create sites. However, sooner or later, developers still have to resort to installing and configuring individual components and connecting other modules. Therefore, we will install all components separately. Windows will be used as the operating system.

What does installing PHP mean? First, we need a PHP interpreter. Secondly, we need a web server, for example, Apache, with which we can access the resources of the site we are creating.

To install PHP, go to the developer’s offsite https://www.php.net/downloads. On the download page, we can find various distributions of the Linux operating system. If our operating system is Windows, then we need to download one of the packages from the page https://windows.php.net/download.

Let’s download the zip package of the latest release of PHP, taking into account the bitness of the operating system on which we want to install PHP.

The PHP interpreter has two versions: Non-Thread Safe and Thread Safe. What are the differences between them? The version Thread Safe allows you to use multi-threading, while the Non Thread Safe single-threaded version. Let’s choose the Thread Safe version.

Unpack the downloaded archive into a folder, which we will call PHP. Let this folder be located in the root of drive C.

Now we need to complete the minimal PHP configuration. To do this, let’s go to the unpacked archive and find the php.ini-development file there.

This is the interpreter’s initial configuration file. Let’s rename this file to php.ini and then open it in a text editor.

Find the line in the file:

 
;extension_dir = "ext"

This line points to the PHP plugins directory. Extensions allow us to use some additional functionality, such as working with a database. All extensions are in the unpacked ext directory.

Uncomment this line by removing the semicolon and specify the full path to the php extensions folder:

  
extension_dir = "c:\php\ext"

The rest of the contents of the file will be left unchanged.

Now let’s install the web server.