Webmaster-Showcase.net PHP Script Debug Hints

Log files

The Yahoo! WebHosting server will write "standard error" (stderr) output of scripts into the file named "scripts.log" in a subdirectory named "logs" of the home directory of your web site.

The web server and the PHP interpreter use that same log file to output errors, warnings and other information useful for debugging.

If the "logs" directory doesn't exist, you get no information. So, if you want to see the errors you must create the "logs" directory.

To prevent others from viewing your scripts.log file, password protect the logs directory.

Syntax errors

The highlight_file(string filename) function may be useful in locating misplaced or missing quotes and other syntax problems.

You can create a "showcode.php" script like this:

<html>
<head>
<title>show code</title>
</head>
<body>
<?php
$target =$HTTP_ENV_VARS["PATH_INFO"];
print("<h1> FILE: $target</h1>");
highlight_file($target);
?>
</body>
</html>

Throughout this web site you see links that say "Show Me How". The link causes the code for the "referer" to be shown using the highlight_file() function.

Home
Show Me How Feedback
Last updated: Fri Nov 8 16:55:51 2002