Skip navigation.
All programmers make syntax errors

Chapter 2 Hints and Help

Chapter 2 provide a general introduction to client/server programming and the use of your web server. This is where you install your Web server, learn to start it and stop it, learn to connect to the server to view your applications, and learn the general procedure of creating applications using a text editor, then saving them, and viewing them in a Web browser.

QUESTION: I need help installing and using my Web server!

ANSWER: The latest instructions to install the Web server are provided on this Web site. There are different instructions for Windows, Macintosh, and Linux users. Follow these instructions carefully and be sure you can start and stop your server and connect to it using a Web browser to view your applications. You will be following this procedure throughout the course.

If you have trouble installing or running the Web server in Windows, refer to Using and Troubleshooting your Web server in Windows, which includes links to video tutorials.

If you have trouble installing or running the Web server on a Macintosh, refer to Installing and Using your Web server on a Macintosh, which includes links to video tutorials.

If you have trouble installing or running the Web server on Linux, refer to Installing and Using your Web server on Linux.

Once you have your Web server up and running, take time to work through all of Chapter 2. Most important, learn to use a text editor to type in the sample programs. Save these programs to the locations indicated in the chapter, and then view them in a Web browser by using a URL that begins http://localhost to connect to your Web server. Be sure to ask for help if you have trouble with any of this. Now is the time to be sure you have everything working correctly. Don't be concerned if the code you type doesn't make much sense at this point. We will be explaining all this in the next three chapters.

QUESTION: Is it OK to use Notepad (Windows) or TextEdit (Mac) as a text editor? What is a good text editor to use?

ANSWER: Windows Notepad is NOT a very good text editor to use, neither is TextEdit for the Mac! They are OK as basic editors but do not contain the kind of features that makes it a pleasure to develop HTML and PHP code (color-coding, easy formatting, search and replace, etc). There are many good text editors out there that will make your coding much easier and faster, and your instructor may have a specific solution for you to use. Here are two easy-to-use editors for Windows and Mac users that many students really like. Follow the links for free downloads..

QUESTION: Help!!! When I view my files in a Web browser I see the code instead of the results (for example MyFirst.php and circle.php). What am I doing wrong??

ANSWER: That means you are not connecting to the Web server to view your applications. Even if you are running the Web server you may not be using the correct URL to connect to it. Here's how to figure out if you are viewing a file incorrectly. Look in your Web browser's address box. If the address begins file:// instead of http://localhost it means you are not connecting to the server. You probably just double clicked a file to view it and that will not work. You can't double-click files in Windows Explorer to view them. If you do you will just see the code. You have to (1) run the Web server and then (2) use the URL that begins http://localhost to connect to the Web server and view the file, for example type the folowing URL:

http://localhost/Webtech/coursework/Chapter02/MyFirst.php

or (to run the circle app):

http://localhost/Webtech/coursework/Chapter02/circle.html

It's even easier to just type http://localhost and then click the coursework link and click your way to the file you want to view.

Read page 34 in the text book and the pages that follow. Ask for help if you still have trouble.

QUESTION: SO exactly how do I develop my applications??

ANSWER: Here's a quick summary of the steps you should be following to develop your applications:

  1. Note that your applications should be located in the appropriate chapter folder in your xampplite/htdocs/Webtech/coursework folder.
  2. Use a text editor to open the file you need to work on (or create a new file if you are developing a new application).
  3. Work on the code in the file as needed.
  4. Save your work in the same location with the same file name (or create a file name if this is a new file).
  5. Start your Web server if it is not already running.
  6. Open a Web browser and type http://localhost to connect to the Web server.
  7. Click the link to the coursework folder and click your way to the file you want to test. Or you can ust type the entire URL, for example: http://localhost/Webtech/coursework/Chapter02/circle.html).
  8. If the file displays correctly then you can move on to the next exercise. Otherwise, go back to your text editor, make corrections to the file and save it, then view it again in your browser.
  9. When you are done with all your exercises, stop the server, then exit the server.

Be sure to always run your Web server when testing your Web pages. AND ALSO always use a URL that begins http://localhost. Although you can test .html pages by just by double-clicking the HTML files in Windows Explorer, this will not work with PHP programs. If the URL in your browser's address window starts with file:// instead of http:// that means you are not connecting to the Web server even if it is running!