Subject Computer Science Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.)


1 Introduction to PHP
This lab walks you through using PHP to create simple applications. PHP is popular for many Web applications, so becoming comfortable with the syntax of PHP will help you diagnose and identify potential security issues.
Learning Outcomes:
At the completion of the lab you should be able to:
1. Execute PHP scripts at the shell prompt within the Ubuntu virtual machine
2. Create simple PHP applications comprised of basic syntax, variables, strings, selection statements and repetition statements. Lab Submission Requirements:
After completing this lab, you will submit a word (or PDF) document that meets all of the requirements in the description at the end of this document. In addition, yourPHP file should be submitted . You can submit multiple files in a zip file.

Part 1
– Execute PHP scripts at the shell prompt within the Ubuntu virtual machine
The Virtual Machine already has PHP installed. It is also configured to run properly on your Apache2 web server. This exercise will walk
through creating a simple PHP script and running it both at the shell
prompt and from a Web browser. We will use the gedit text editor to create the PHP file.
Running the script from the shell prompt is very useful for debugging as syntax errors will appear when code issues occur.

3.To create a new document just begin typing or copying and pasting the PHPcode shown below:
<!DOCTYPE html>
Jan 22, XXXX
<title>My First PHP Script </title>
<h1>Welcome to SDEV 300. </h1>
<h1>The following greeting is from PHP </h1>
echo "Hello, SDEV 300 students and class!</br>";
echo "The current time is " . date("g:i:h a"); ?>
Save the file in the /var/www/html/week
3 folder in a file named
. Note,
you may need to create a folder named week 3 . Recall the /var/www/html is the location of the Apache2 web server html files. Creating separate folders for each week or application will help organize the server.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

<!DOCTYPE html>

       <meta charset="UTF-8">

       $radius = 2.65;
       $length_r = 4.2;
       $width = 5.6;
       $base = 10.2;
       $heigh = 5.4;
       $length_s = 5.3;

       <table border="1" width="800">
                <td style="text-align:center; vertical-align:middle;">
                   <img src="img/circle.png" alt="" width="40"/>
                   <br />
                   Area =
                   $result = 3.14 * $radius * $radius;
                   echo $result;
                   square meters
                   <br />
                   Circumference =...

This is only a preview of the solution. Please use the purchase button to see the entire solution


or $1 if you
register a new account!

Assisting Tutor

Related Homework Solutions

Get help from a qualified tutor
Live Chats