Skip to content

CS 3305 - Web Application Development 2 - Compiling Server Software From Source

Programming Assign. Unit 2

Part 1:

<?PHP
phpinfo();
?>
  • After you type the code, click the Execute command.
  • Take a screenshot of your code’s output (the screenshot should show everything up to the last /etc command).
  • Save the screenshot in a word processing program and name the document index_php.
  • Note that the output displays the server configuration information. If you had an actual server created that you were using, you could use the command to display the server configuration

solution 1

  • I have been working with PHP for a while, so I had my server running locally, and I did not go to the website. I just typed the code in my editor and ran it. I got the following output.
  • I will explain all steps that I did to get the output.
  • first, I navigated to the directory where I wanted to create my project, then created a file called wa2.php and opened it in my editor.
  • I typed the code in the file and saved it.

wa2

  • I opened my terminal and navigated to the directory where I saved the file.
  • I started my server by running the command php -S localhost:4000 -t . as shown in the image below.

wa2

  • opened my browser and navigated to localhost:8000/wa2.php and got the following output.

wa2

wa2

  • I could have run the file in the command line by running the command php wa2.php and got the same output, but in my terminal.

wa2


Part 2:

  • Return to the following website: https://www.tutorialspoint.com/execute_php_online.php

  • Clear out the code that you typed in Part 1 of the assignment.

  • Create PHP code that outputs the following:

    • PHP is sorta Fun!
    • My Hello world! program
    • There is a lot more to learn about PHP!
    • My name is yourname_
  • Once you have created your code, click Execute.

    • Take a screenshot of your code’s output.
    • Copy this screenshot in the Word document, index_php that you created in Part 1 of the assignment.

solution 2

  • I cleared the code in the editor and typed the code as shown in the image below.

wa2

  • I started my server (following same steps in the first part) and navigated to localhost:4000/wa2.php in the browser and got the following output

wa2