How to run PHP files on XAMPP


If you are new to developing or testing your website, chances are you are recommended to use XAMPP. This is a free, stable and regularly updated server solution. In case you are programming in PHP, you are lucky to run PHP file in XAMPP extremely easily and thuthuat.taimienphi.vn will guide you how to perform details.


1. What is XAMPP?

XAMPP is an open source and cross platform web server package. The program, developed and updated by Apache Friends, is completely free to download and use. The main components include Apache HTTP Server and MariaDB database. It also includes interpreters that can read the Perl and PHP programming languages.

How to run php files on xampp 2

XAMPP is compatible with Linux, Windows and Mac operating systems. This makes the program a super flexible server solution. It also supports LAMP and WAMP.

XAMPP is the abbreviation, with the abbreviations are the components included in the program:

– X means multi-platform.
– A is Apache server.
– M is the MariaDB database (or MySQL).
– P is PHP
– P is PERL.

2. How to open PHP files in XAMPP

Opening and running PHP files in XAMPP is easy and simple. All you need is a working copy of XAMPP and a PHP file. Then follow the instructions below:

Step 1:

First, download XAMPP. You will need an XAMPP version appropriate for the operating system on your computer. You should choose the latest version of the program.

Step 2:

Next, you install XAMPP on the computer. The most common way is to install the program on C drive, although some users choose to install it on drive D or other non-system partitions.

To install XAMPP, right-click the downloaded installer file. Click the button Run to start the installation process. Follow the installation wizard to complete the process. In the section Components, you can choose to skip some components if you’re sure you don’t need them. However, you should retain everything and install the full version.

The default location is C: xampp. You can change it if you like, but you shouldn’t.

How to run php files on xampp 3

Step 3:

In this step, you will create the project directory where you will save the PHP file you want to run in XAMPP. To do that, go to the directory XAMPP and open the folder hitdocs. There, create a new folder and name it according to the file you will paste into it. Alternatively, you can also name it NewProject good Project 1 or any other name.

Step 4:

If you already have a file you want to open with XAMPP, browse it. Once you’ve located the file, copy and paste it into the folder you created in step 3. You can also cut and paste the file.
If you don’t have a file and want to create a PHP file first to test XAMPP, do the following:
– Go to the directory just created in the previous step and create a new text file in it. Name the file and change the extension from txt to php. Note: Do not put punctuation at the end of each statement because they are only used for grammar related purposes.
– Open the file with a text editor, both Notepad and Notepad ++ are all great options. Open your HTML document with

. In the next line, open the header with

Title

. Close the header in the next line with.

– Next, you enter

on the next line. Press Enter several times and press TAB to indent. Type

– Then, press Enter again and type?>. This will end the PHP part. In the next line, you enter

. Below that line, you enter. Press Ctrl + S to save the changes in the file. Finally, your file might look like the image below:

How to run php files on xampp 4

Step 5:

Now open the file in XAMPP and here’s how:

– Open XAMPP. You can open the program via the status bar icon or search in the Start menu if you use a Windows computer.

– In the window Control Panel of the program, click the button Start in the Apache line to open the Apache server. The Apache label will turn green and you will see a message in the log below, indicating that the server is up and running.

how to run php file on xampp 5

– Now open your web browser and enter localhost in the address bar.

– Click on the option localhost – Welcome to XAMPP just below the address bar.

– You will be redirected to localhost / dashboard. Replace section dashboard with the name of the directory where your PHP file is stored, such as localhost / NewProject.

– In the list of files in the displayed directory, click the PHP file.

– If all goes well, your PHP file will be opened in the browser.

https://thuthuat.taimienphi.vn/cach-chay-file-php-tren-xampp-54571n.aspx
As a free and open source solution, XAMPP is a popular option for web developers and testers working on a tight budget. In addition, XAMPP is also a Web server creation program trusted by many experts. Cross-platform support is one of the factors that makes it more popular.

.

Add a Comment

Your email address will not be published. Required fields are marked *