Tutorials Running A PHP File in XAMPP

in utopian-io •  7 years ago  (edited)

12.jpg

What Will I Learn?

  • You will learn to run php file in xampp
  • You will learn how to file php

Requirements

  • You have a basic PHP
  • You have a baseline about Xampp
  • To practice this tutorial required a text editor, browser and Xampp

Difficulty

  • Basic

Tutorial Contents

To access the PHP page from a web browser, then you have to place the PHP file inside a special folder which is the home folder of the web server.

In the XAMPP application, the folder is a htdocs folder that is inside the XAMPP installation folder. If you changed your XAMPP installation to C:\xampp, then the folder should be in C:\xampp\htdocs.
2.png

3.png

You can put the PHP file directly inside this folder, or to make it easier to search the file, create a new folder in this htdocs folder. I will create a "belajar" folder. Folder belajar is what we will make as PHP file later.

How to Write a PHP File

The PHP file is basically a plain text file that can be created using the windows notepad app, but for more features you can use a text editor application like Notepad ++, which can be downloaded at Notepad++.

Go back to the learning folder belajar located at C:\xampp\htdocs\belajar, we will create a new file. To create this file you can use the default notepad of Windows and Notepad ++.

As a file contents, type the following code:

<?php
echo "Tantry sedang belajar PHP";
echo "<br />";
echo "Hello Steemit And Utopian-io";
?>

Then save as test.php. So the file will be at the address C:\xampp\htdocs\belajar\test.php. To date, we have actually created a simple PHP file. To run it, we must use a web browser.

How to Run a PHP File

Next open the browser, and type the following address: localhost/belajar/test.php in the address bar and press Enter.

If you follow the above steps correctly, then in the web browser will look like the display as follows:
4.png

Good luck good luck if you follow correctly definitely the way in the browser do not forget to be happy



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • Tutorial is very basic and does not meet utopian standards.

You can contact us on Discord.
[utopian-moderator]