Full Stack Web Development Internship Program
- 29k Enrolled Learners
- Weekend/Weekday
- Live Class
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.
Xampp is the most popular PHP development environment for Windows, OS X, and Linux platforms.
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.
Select the installation directory so that all the components that you choose will be installed in this directory.
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.
PHP is a case sensitive language and it might be confusing for some of you.
Variable names are case sensitive whereas Function names, Class names and Keywords (e.g., if, else, while, echo, etc) are not case sensitive in PHP.
Let’s discuss the case sensitivity in PHP with some examples.
Consider the following example.
Since, the echo statement is not case-sensitive.
Therefore, echo, ECHO, and EcHo have the same functionality.
Hence, they print Hello Anupam! three times without throwing any error.
Let’s consider another example
Since variable names are case sensitive.
Therefore, $color, $ColoR, and $COLOR are treated as different variables.
Hence, it throws an error when executed.
In order to correct this error, you should use the same case for the variable name throughout the script.
Here, the same variable name $color is used throughout the script.
Hence, it will print the desired output successfully.
2. Write your PHP script in the notepad.
For reference you can use the below script or use your own PHP script as well.
<?php echo "Hello Anupam!"; ?>
This concludes this article. I hope you have learned about XAMP, how to install it, and how to run a PHP program in Xampp.
Save your PHP code in a file with .php extension and run/host it on localhost using web servers like Apache. The PHP CLI can also be used for the same.
We can use the php command followed by the file name to run the PHP script on command line.
php <file_name.php>
Use local web servers to host the PHP file. It can be accessed using http://localhost/<file_name.php> on the Chrome browser. Examples of local web servers are XAMPP or WAMP.
Use web servers with a PHP interpreter. XAMPP, WAMP, and MAMP can be used, as they include both the web server and PHP. The PHP CLI can also be used for the same.
If you want to start a career in the Node JS Field then check out the Node JS Online Course 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.
edureka.co
so good my bro i am so grateful