PHP and MySQL (54 Blogs) Become a Certified Professional

How to run a PHP program in Xampp?

Last updated on Jul 16,2020 54.6K Views
Aayushi Johari
A technophile who likes writing about different technologies and spreading knowledge. A technophile who likes writing about different technologies and spreading knowledge.
How to run a PHP program in Xampp?

PHP is the most popular web backend programming language. A PHP code will run as a web server module or as a command-line interface. To run PHP for the web, you need to install a Web Server like Apache and you also need a database server like MySQL. There are various web servers for running PHP programs like WAMP & XAMPP. WAMP server is supported in windows and XAMP is supported in both Windows and Linux. In this article, you will learn how to run PHP program in Xampp server.

Below topics are covered in this article:

Let’s get started.

What is Xampp and why it is used?

xampp- how to run php program in xampp - EdurekaXampp is the most popular PHP development environment for Windows, OS X, and Linux platforms.

Xampp stands for Cross platform(x), Apache(a), Maria db(m), PHP(p), Pearl(p) which is a software distribution server which makes developer’s work eaiser for testing and deploying by creating a local web server.

 

How to install Xampp?

It is completely free and easy to install Apache distribution containing MySQL, PHP, and Perl. First, download XAMP from https://www.apachefriends.org/download.html. In the first page, select the components you want to install.

Xamp - how to run php program - Edureka

Select the installation directory so that all the components that you choose will be installed in this directory.

Xamp Installation - how to run php program - Edureka

XAMP also allows you to easily install PHP based applications. Bitnami module provides the easiest way to install WordPress, Drupal or Joomla among others on top of your XAMP after the installation you will see the control panel.

Once you are done with Xampp installation, let’s move ahead and see how to run a PHP file in xampp server.

How to run PHP program in Xampp step-by-step?

  • Write this program in a notepad and save it as file.php or any other name.

<?php echo " hello ashok" ?>
  • After completion of the installation, you can use the XAMPP Control Panel to start/ stop all servers.

  • Start Mysql and Apache servers.

Xamp Control Panel - how to run php program - Edureka

  • Copy file.php to htdocs (C:/Program Files/XAMPP/htdocs)

  • You can also create any folders inside htdocs folder and save our codes over there.

In order to get the dashboard for localhost: search http://localhost in any browser.

Xamp UI- how to run php program - Edureka

  • Now to run your code, open localhost/file.php then it gets executed.

output - how to run php program - Edureka

With this we come to an end of this article. I hope you have learned about XAMP, the installation of XAMP and how to run a PHP program in Xampp.

If you found this Tutorial blog relevant, check out the PHP Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.

Got a question for us? Please mention it in the comments section of ”how to run a php program in xampp” and I will get back to you. 

Comments
1 Comment
  • Abdallah says:

    so good my bro i am so grateful

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.