Back to DFS's Workshop Page
Back to Agenda Page
Your second script, as did the first, will generate the traditional "Hello, World!" greeting. However, this time you will use a combination of PHP along with HTML to create a web page on the fly. Follow the simple steps below.
Type
cdto get to your home directory.
Type
cd public_html/test_phpto descend into your php script directory.
Edit the file called helloworld.php so that it looks like the following code.
<!-- helloworld.php This file illustrates how to embed PHP code inside HTML --> <html> <head> <title>PHP inside HTML: Hello World</title> </head> <body> <?php echo "<h1 align=\"center\">The Hello World Program Output</h1>\n"; // Print the message echo "<p>Hello, World!\n"; ?> </body> </html>
In your favorite web browser, type
http://localhost/~YOURID/test_php/helloworld.phpwhere YOURID is the user ID you have on the system.