What is Xampp?
XAMPP is a cross-platform and open-source web server package. It is completely free to download and Apache Friends develops and updates use.
The major components include the Apache HTTP Server and the MariaDB database. Also included are the interpreters that can read Perl and PHP scripts.
XAMPP is compatible with Linux, Windows, and Mac operating systems, making it a super-versatile server solution. It also supports LAMP and WAMP stacks.
XAMPP is an acronym, with the letters standing for the following:
- X is for cross-platform
- A is for the Apache server
- M is for the MariaDB database (it used to stand for MySQL)
- P is for PHP
- P is for PERL
How to Open and Run a PHP File 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. Let’s see how you can do this.
First, let’s get XAMPP. You’ll need to get an appropriate version for your operating system from the Apache Friends’ official site. Launch your favorite web browser and go to https://www.apachefriends.org/index.html.
When the Home page of the site opens, you should click on the latest version of the program for your operating system. At the time of this writing, PHP 7.3.7 is the latest one for all three major OS platforms.
Click on the one you need to download.
Next, you should install XAMPP on your computer. The most common practice is to install it on the C drive, though some users opt to install it on D or other non-system partitions.
To install XAMPP, double-click on the installer file you downloaded. Click on the Run button to start the installation. Follow the installation wizard to complete the installation.
However, In the Select Components section, you can opt to leave some components out if you’re sure you won’t need them. However, it is recommended to keep everything as is and install the full version.
The default location is C:\xampp. You can change it if you want to, but it is recommended not to.
- How to Cancel a Steam Account
- How to Configure PCSX2
- Steps to Convert Acsm to PDF
- How to Block & Unblock a Phone Number
In this step, you’ll create the project folder where you’ll save the PHP file you’d like to run in XAMPP. To do that, go to your XAMPP folder. If you haven’t altered installation options, they installed your copy of XAMPP on the C drive.
Once you get to the XAMPP’s main folder, go to the htdocs folder. There, create a new folder and name it after the file you’ll copy into it. Alternatively, you can name it “NewProject,” “Project 1,” or give it any other name.
If you already have a file that you want to open with XAMPP, browse for it. Once you’ve located it, copy and paste it into the folder you created in the previous step. You can also cut and paste the file.
If you don’t have the file and you want to create your first PHP file to test XAMPP, here’s what to do. Go to the folder you created in the previous step and create a new text file in it.
Name the file and change its extension from txt to php. Before we start, here is a word of warning: don’t enter the full stops at the end of the commands, as they are only there for grammatical purposes.
Open the file with a text editor, both Notepad and Notepad ++ will be good. Start your HTML document with <html>. In the next row, open the header with (<head><h 1>Title</h 1>). Close the header in the next row with </head>.
Next, open the body container with <body> in the next row. Press Enter a few times and press TAB for indent. Type in <?php. Press Enter once or twice and write the following command print “text”.
Between the quotations, you should write what you want to see when you open the file with XAMPP.
Press Enter once more and type ?>. This will end the PHP section. In the next row, you should type </body>. In the row below that one, you should type </html>.
Press Ctrl and S keys on your keyboard to save the changes to the file. Your file might look like this at the end:
Now, let’s open the file with XAMPP. Here’s how to do it:
- Launch XAMPP. You can open it via the status bar icon or search for it in the Start menu if you’re on a Windows computer.
- Once the app opens, you will see its Control Panel. Click on the Start button in the Apache row. This will launch the Apache server. The Apache label in the Module column will turn green and you’ll see a message in the log at the bottom of the Control Panel informing you that the server is running.
- Now, open your browser and type “localhost” into the address bar (omit the quotations).
- You should see the “localhost – Welcome to XAMPP” option right below the address bar. Click on it.
- You will be redirected to localhost/dashboard. Replace the dashboard part with the name of the folder where your PHP file is located. In our case it looks like this: localhost/NewProject.
- You will see the list of files in the said directory. Click on your PHP file.
If everything’s OK, you should see your PHP file open in your browser.
- How to Fix an NSIS Error Caused by Installation File 2022
- The 7 Best Windows File Explorer Alternatives and Replacements
- How to Open an AI file without Adobe Illustrator Software in 2020/2021
- How to Write a Company Profile with Samples and Templates to Aid You
- Ways to Transfer Files From One Google Account to Another
- Windows Proxy Settings Error Message? How to Identify & Fix This Issue
- What to do when your Hard Drive doesn’t Show 2022 Latest Update
In Conclusion, as a free and open-source solution, XAMPP is a common option for web developers and testers running on a tight budget.
What’s more, many professionals use it, too. The fact that it’s compatible with Linux, Windows, and Mac makes it even more popular.
There is never a time that isn’t right to help. If this information was useful to you, do well to share it with friends and loved ones. It’s your turn to help other people.
You can share this article on your favorite social media handle.