In this lesson we will create a basic PHP file that outputs some text into our web browser.
First, confirm WAMP/MAMP server is correctly configured and working.
Open your web browser and type: localhost
You should then see this page displayed. This is the default WAMP page.
It provides some important information about the Server Configuration, including the Apache and PHP Version.
It also lists some tools that are included in your package. We will be using these tools in the next section when we work with MySQL database.
The page also lists the websites contained in your web root (www) folder. Here we can see the folder we created in the last lesson: phplessons. Remember that this is where all our files will be saved for this section of the course.
To make sure your scripts are working correctly, open your text editor and type in the code displayed.
echo "Hello World!<hr />";
We will discuss the actual code in the next lesson. This file will just output the text: Hello World! In your web browser using the Php echo command.
Save the file in your phplessons folder, as intro.php. You can actually give it any file name, but the .php extension is very important.
Now in your web browser, type in:
You should now see the text Hello World! displayed in your browser.