Beginner PHP Tutorial - 4 - Creating Your First PHP File

2015-09-05 81 Dailymotion

Download Convert to MP3

Example: Hello World!
Start by making an ordinary HTML document, but name the file page.php and save it in the root of the site:
If you use XAMPP (see lesson 2), the path for the root is "c:\xampp\htdocs\page.php" on your computer (which is now a server). Read more abot saving PHP files in XAMPP.
If you have a website on a host that supports PHP, you simply upload/ftp the file to your web host.
The HTML code should look like this:




My first PHP page









As you probably remember from lesson 1, PHP is all about writing commands to a server. So let's write a command to the server.

First, we need to tell the server when the PHP will start and end. In PHP you use the tags to mark the start and end for the PHP codes that the server must execute (on most servers it will be suficient to use just

My first PHP page



Hello World!";

?>



When we look at the PHP document in a browser, it should look like this: