...
Use the CGI/PHP Verification Tool - We have an On-Line Verification Tool that you can use to check your URL. It will report many common errors and give you tips on how to fix them. It is not capable of detecting all possible problems, but is definitely the first place to start.
Permissions Problems - The permissions on your php scripts need to be set so they are readable by the web server. In addition, the full path leading up to the script must be searchable by the apache server. The easiest way to do this is to make sure your cgi-pub directory (and any sub-directories you create there) are world searchable. This can be done in a number of different ways but one simple way is as follows:
Code Block $ chmod go+x cgi-pub $ chmod go+x cgi-pub/somedirectory
You will also get errors if your cgi-pub directory is writable by others so you can make sure this is not a problem by running something like:
Code Block $ chmod go-w cgi-pub $ chmod go-w cgi-pub/somedirectory
- suPHP Errors - See the above section on suPHP for information about possible problems you may encounter when running under suPHP.
- Incorrect Script Naming - PHP scripts must end with .php filename extension.
Coding Errors and Log Access - In many cases, if you are getting server errors it is just due to errors in your php code. You can determine the cause of coding problems by looking at the apache error logs. In order to view the error log output you will first need to ssh to the cgi server, cgi.soic.indiana.edu. Once you are logged in there you may find it helpful to tail the error log while you access your page looking for errors. For example:
Code Block $ ssh cgi.soic.indiana.edu <... then, once logged into the cgi server...> $ tail -f /var/log/httpd/error_log | grep username
In this example, the grep for your username (and you need to replace username with your actual username or the username of the account in which the php files reside) is done so you only see your errors and not the errors from every user of the system. Note that not all script errors will contain the username of the user who owns the scripts. If you aren't seeing the appropriate errors this way, you can always view all errors with:
Code Block $ tail -f /var/log/httpd/error_log
Just keep in mind that this is likely to give you a high volume of errors that you will have to sort through.
Not all possible errors will show up in this log file but you should see errors related to many of the mistakes you are likely to make. Furthermore, not all errors will include your username so you can also do the tail without the pipe to grep to get the full output. Similarly, you can also tail the access_log file in the same way if you want to watch the accesses to your page and not just the errors. Just substitute "error_log" with "access_log" in the above exampleexamples. In this case your username will appear in all accesses so you almost certainly want to use the pipe/grep of your username as shown above.