Run PHP 8 program in XAMPP Server on localhost

PHP 8 release 26th November 2020.  With that, the XAMPP support is now live for PHP 8. In this article, we will see how to set up XAMPP for PHP 8. With that, we will also see how to run your first PHP 8 program on localhost Windows 10.

Let’s start with installing XAMPP, and running the first PHP program using XAMPP Server on localhost. The following are the steps:

  • Download and Install XAMPP
  • Create a new project in XAMPP and add your PHP program
  • Open XAMPP and run your first PHP program

Download and Install XAMPP

Step 1: Go to the Apache Friends website and download XAMPP Server (supporting PHP 8). Apache Friends is the official website to download XAMPP:

Download XAMPP for PHP 8

Step 2: After downloading, install it.

You can install it at any location. We installed XAMPP i.e. C: drive,

Create a new project in XAMPP

Step 3: Now, go to the htdocs folder in the Xampp folder and create your project folder.

Here, a folder AmitProject created, as in the below screenshot:

Create new PHP 8 project in XAMPP htdocs

Step 4: Create a new PHP 8 file with the .php extension. We have created a file with the name, demo.php.

 Create a new PHP 8 program file

Add the following sample code to it. We are printing a line in our PHP 8 file. We have embedded HTML code in the PHP file:

Open XAMPP and run your first PHP 8 program

Step 5: Go to the start button, and type Xampp Server to open it.

This will open Xampp Server- Control Panel.

After opening it, just click Start on Apache to start the server. If “Status change detected: running” is visible, that means Apache Server ran successfully.

Start Apache Server from XAMPP

Step 6: Now, go to the Web Browser and type the following and press enter:

On pressing ENTER, the following will be visible i.e. the location of your project directory with the files in it.

Locate your PHP file demo.php and click on it,

Running first PHP 8 program on localhost

Step 7: After clicking demo.php, just press enter in the address bar, and you can see the output of your first PHP program demo.php:

Run First PHP 8 program on Windows 10 localhost

We saw how to run a PHP 8 program using XAMPP Server on localhost. A step-by-step process to create a new PHP program file and run it to get the output.

Video Tutorial: Run PHP 8 on XAMPP

Here’s the video, explaining the steps shown above,

Note: You do not have to START Apache Server again and again. But, yes, if you “shut down” and “restart” your system, then there is a need of starting the server again.

Hope you liked the tutorial, kindly share it with others.

If you have any queries, then please mention them in the comments section below.


Read More

Run your first PHP program in XAMPP Server on localhost
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading