PHP 8 Installations Guide

To run PHP 8 applications, either you should have a web hosting account that supports PHP 8 and MySQL or you should have Web Server, PHP 8 and MySQL software installed on your local machine. Generally, PHP is used with MySQL.

There are two ways to install these on your local machine, either you can install a package that contains all (Web Server, PHP 8 and MySQL) or you can install each individually.

PHP 8 Installation on Windows

Package Installation

Please click on the below link based on the operating system you are using and download the most recent version.
WAMP - This is recommended for Windows Operating System users only. This provides support for Apache, MySQL and PHP.
XAMPP - This is more powerful and available for Windows, Linux and OS X. This provides support for Apache, MySQL, PHP and Perl.
LAMP - This is recommended for Unix and Linux users. This provides support for Apache, MySQL and PHP.





Manual Installation

Manual Installation takes more installation time from package installation, but for a learning purpose, it would be better to install each individually.

These are the official sites to download and install each manually.

PHP - http://php.net/downloads.php
MySQL - http://www.mysql.com/downloads/
Apache - https://httpd.apache.org/download.cgi

These are the full installation and configuration guide provided by the PHP official site based on the operating system.

Installation on Windows systems - http://php.net/manual/en/install.windows.php
Installation on Unix/Linux systems - http://php.net/manual/en/install.unix.php
Installation on Mac OS - http://php.net/manual/en/install.macosx.php



Testing the installation

It is necessary to test out the installation. For this, create a PHP file in your web directory and write the following script in it.

<?php phpinfo(); ?>  

Let us save the above script as 'sample.php' and start the server installed on your machine, suppose the webserver is running at -

http://localhost/sample.php

Invoke the above url, if the installation is fine, you will see all the php configuration variables and their values.

The PHP official website www.php.net provides information of each of the latest releases and future releases and features planned for the language.





PHP 8 Installation on Ubuntu

We will have to follow these steps for installing the PHP 8 on Ubuntu. Open a new terminal and run the following command -

$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update

This will add the PPA which contains all PHP packages and their dependencies. Once this is enabled, run the following command to install PHP 8 -

$ sudo apt install php8.0-common php8.0-cli -y

You can ensure PHP 8 is installed by running the following commands:

php -v # Display PHP version
php -m # Display the loaded PHP modules


Read more articles


General Knowledge



Learn Popular Language