Programming 4


Lesson 9

Assignment:Install Student Files and understand concept of pathing For PC(path)

 

Objectives:

  • Use a Web Server to Test client/server applications
    • Start and stop the XAMPP Web Server as well as exit correctly
    • Configure your USB Drive for the files and folders needed for CTI 110
    • Test your XAMPP installation (Server) by running a program (Application)
    • Understand and use pathing concepts in creating and testing programs (applications).

Lab Task Checklist

  • Read the Required Reading
  • Review the entire assignment before starting.
  • Install the student files (cti110.zip attached) on your USB in the location that XAMPP expects to find them (htdocs). The default location that XAMPP expects to find all .html and. php files isin the “htdocs” folder (with H: being your USB drive)
  • File Name Convention: lastname-path.docx
  • Answer the Assignment Questions and snip your screen shots as required. Paste them into a single word document.
  • Upload to Blackboard.

 

Instructions for assignment

  1. Download the attached cti110.zip file from Blackboard.
  1. For XAMPP to run and test your programs, they must be in the /htdocs Using the windows directory address, extract cti110.zip to your/xampp/htdocs/cti110 folder (example below):

**Note: Your path may differ.  You may have a different drive letter or folder structure.  It is important to know what you path is so that when you test…you know how to get there.

 

  1. Testing the Files and Folders with your Web Server/XAMPP.
  2. Open your XAMPP Control Panel as and start your web server as the ADMINISTRATOR n if it isn’t already running. ALWAYS RIGHT CLICK AND SELECT RUN AS ADMINISTRATOR. You may have to refer to the previous (“Install a Web Server”) on how to open.
  3. If you have moved your USB or are using another system since you installed XAMPP, you may need to run the setup_xampp.bat. Instructions can be found in the previous lab (“Install a Web Server”) and in the installation instructions found in Course Resources under XAMPP.
  4. If you have followed directions and have the SAME path as expected in the lab, you should be able to open any Web browser and type the URL: http://localhost:portnumberused/cti110/. This will take you to the index file within cti110.

 

** Notice the URL is relative and not absolute like the windows path.  This is because the XAMPP web server starts in /htdocs as a default. This is why you did not have to put /public_htmlin your previous URL addresses using Apollo. When the Apollo web server starts…given you username it will start in the /public_html folder of that user.

 

If you are using the default port (did not change the port number) then your address may be: http://localhost/cti110.If you have a different path than you need to change to that path.

  1. You should see a page with the title “CTI-110 Server and Database Guidance”. You will also navigation links internally and externally.  To see the URL directory for samples, click on the navigation link. If you are using the correct URL address, then it should look like this:

 

Use the URL Address To Run and Test

**You can also go to any address directly by adjusting the path.  For example, going to samples directly without using the index would be: http://localhost:portnumberused/cti110/samples

 

  1. Run the program “add-two-numbers.html” and you will see a Web page that displays a form that asks for two numbers.
  2. Type in two numbers and click the “Tell me the sum” button.
  3. You can take this approach to run files in all your folders found under “htdocs”.
  4. Click the “Coursework” link from the main “cti110” page to run files in the coursework folder.
    1. From here go to the labs folder.
    2. Run hello-almost-done.html:

Use the Windows directory address to edit your files …realize it will not run or test

 

If you were to try to run these files within the Windows directory, you would get an error and it would not run.  Let’s run add-two-numbers.html again but from the windows address.

Although the .html renders just fine (client-side with browser app) when you click the submit button you do not the .php program does not run.  Instead, it returns the code in html…which can be a major security issue!!

Assignment Questions:

Answer the following questions (some require a snap shot) and put them in a word document and upload to Blackboard.

  1. cti110 file structure:
  2. How many files in the root of /htdocs/cti110? Take a snapshot of the windows address directory structureand put in your word document.
  3. What comes up when you use the URL address of localhost to the cti110 folder in htdocs? Why? Hint: review the files found in the cti110 folder.  One controls the view.
  4. How many folders are in the root of coursework and what are they named? Take a snapshot of the URL address structureand put in your word document.
  5. How many files are in the root  of /coursework/labs. What are they named?
  6. How many folders are in the root  /htdocs/cti110?  Take a snapshot of the windows address directory structureand put in your word document
  7. hello-almost-done.html questions (Found in the coursework/labs folder)
    1. What are two tips that will help you be successful in the remainder of this course?
    2. Where should you save your files for the remainder of the course.