Web hosting services - 585Chapter 32DebuggingCompile-time bugsPHP is a compiled language it s compiled
Friday, August 24th, 2007585Chapter 32DebuggingCompile-time bugsPHP is a compiled language it s compiled just before it executes, so the compilation isn t asobvious as it is in C or Java. A compile-time bug is obvious to the Zend Engine, which does the compiling. The compilerwill raise an objection, often with a line number, and you can go fix the problem. Examples of compile-time errors are mistyped variable names, forgotten semicolons, and mismatchedparentheses. Run-time bugsA run-time bug doesn t appear until after your program is under way, and may result fromsome outside condition, such as unexpected input from a user or unanticipated behavior by a database. These have to be tested for, as they usually won t make themselves evident toprogrammers under all conditions. Logical bugsLogical bugs are perhaps the most difficult of all to spot and can be very difficult to fix if theyresult from an error in thinking. Say you wanted to launch a space probe and have it enter orbit around Mars. However, becauseyour navigation algorithm didn t allow for metric input from those pesky Europeans, yourspace probe crashed into the Martian surface. The software did exactly as it was told, which, strictly speaking, was to drive the rocket into Mars. That s a logical error. The point: Make sure your programs not only generate output, but generate the correct output. Get out the calculator and make sure the program s results are right, or compare its results tovalues known to be good. And don t use PHP to program spacecraft, just to be safe. For a guide to the most common symptoms of the most common compile-time and run-timebugs, see Chapter 11. Using Web Server LogsBecause most PHP programs result in some sort of HTML page, which is in turn served by an HTTP server such as Apache or Microsoft Internet Information Server (IIS), it is possiblefor errors to be introduced by the Web server software. For that reason, it is important to befamiliar with the way in which your Web server manages error reporting and logging and toknow how to access and interpret the logs you need. ApacheThe Apache HTTP Server maintains two log files in plain text format. They are: .Apache/logs/access.log: Notes every HTTP request for a file, including its date, time, and result (success or failure, as indicated by a numeric status code). The access logalso records the IP address from which each request came. .Apache/logs/error.log: Records error conditions only. Cross- Reference36
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.