1. What is XAMPP?
XAMPP is an open source and cross-platform web server package. The program is developed and updated by Apache Friends, completely free to download and use. The main components include the Apache HTTP Server and the MariaDB database. It also includes interpreters that can read the Perl and PHP programming languages.
XAMPP is compatible with Linux, Windows and Mac operating systems. This makes the program a super flexible must-have server. It also supports LAMP and WAMP.
XAMPP is an abbreviation, with the initials representing the components included in the program:
– X means cross-platform.
– A is the Apache server.
– M is the MariaDB (or MySQL) database.
– P is PHP.
– P is PERL.
2. How to open PHP files in XAMPP
Opening and running PHP files in XAMPP is easy and straightforward. All you need is a working copy of XAMPP and a PHP file. Then follow the steps below:
Step 1:
First, download XAMPP. You will need a version of XAMPP that matches the operating system on your computer. You should choose the latest version of the program.
Step 2:
Next, you install XAMPP on your computer. The most common practice is to install the program on the C drive, although some users choose to install it on the D drive or other non-system partitions.
To install XAMPP, right click on 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 omit some components if you’re sure you don’t need them. However, you should keep everything and install the full version.
Default location is C:xampp. Users can change it if they want, but they shouldn’t.
Step 3:
In this step, you will create the project directory, where you will save the PHP file that you want to run in XAMPP. To do that, you go to the folder XAMPP and open folder hitdocs. There, create a new folder and name it after the file you’ll be pasting into. Alternatively, you can also name it NewProject nice Project 1 or any other name.
Step 4:
If you already have a file you want to open with XAMPP, browse it. After determining the location of the file, copy and paste it into the folder you just created in step 3. You can also cut and paste the file.
If you don’t have the file and want to create a PHP file first to test XAMPP, do the following:
– Go to the folder 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 marks at the end of each statement as they are used for grammatical purposes only.
. In the next line, open the header with
. Close the header in the next line with .
– Next, you enter
in 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 type . India Ctrl + WILL to save the changes in the file. In the end, your file might look like the image below:
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, you click the . button Start in the apache line to open the apache server. The Apache label will turn green and you’ll see a message in the logs below, indicating that the server is up and running.
– Now, you open a web browser and type localhost in the address bar.
– Click on option localhost – Welcome to XAMPP right below the address bar.
– You will be redirected to localhost/dashboard. Replace part dashboard with the name of the directory where your PHP files are stored, such as localhost/NewProject.
– In the list of files in the directory just displayed, click on the PHP file.
– If everything is fine, 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 among web developers and testers working on a tight budget. In addition, XAMPP is also a Web server creation program that is trusted by many professionals. Cross-platform support is one of the factors that make it more popular.
Related keywords:
run PHP files on XAMPP
open PHP file on XAMPP, how to run PHP file on XAMPP,
Source link: How to run PHP files on XAMPP
– Emergenceingames.com