1 [[!meta title="How do I debug my scripts?"]]
2 Unfortunately, scripts.mit.edu does not support per-user error logs
3 (yet!), so debugging a recalcitrant CGI script may be a little
4 difficult. While the Scripts team hopes to add error logging in the
5 near future, here are some immediate ways you can convince your
6 scripts to give you more information:
8 - You can view error logs in real time using the ‘logview’
9 command on a Scripts server. Note that you need to be SSH’ed into
10 the server that is serving your website, and not necessarily
11 scripts.mit.edu server. You can determine what server you are being
12 load-balanced to by checking the bottom of http://scripts.mit.edu
13 and looking for “You are currently connected to XXX.mit.edu”
14 server. This will not display all errors: in particular, if an
15 error message spans multiple lines, you will only see the first
16 line, and error messages with no data associated with your locker
19 - If you have a PHP script that is failing with no error output,
20 you likely have error reporting turned off. Open or create a
21 php.ini file in the same directory as the script, and in it ensure
22 that “display\_errors = on” and “error\_reporting = E\_ALL \^
23 E\_NOTICE”. This will cause errors to be displayed on the web
26 - If you have some script that you know is writing information to
27 stderr that you want to see, you can often run it directly from the
28 command line via SSH to scripts and see if it outputs anything
29 interesting. Nota bene: the configuration of the command line may
30 be subtly different than that invoked from the web, for example,
31 php from the command line will not load a php.ini file in the
32 directory; you’ll need to manually add it with -c
34 - If your FastCGI script is not working and you’re getting error
36 [Fri Oct 29 20:31:04 2010] [notice] mod_fcgid: process
37 /afs/athena.mit.edu/contrib/scripts/web_scripts/index.fcgi(15116)
38 exit(communication error), terminated by calling exit(), return code: 121
40 this probably means your index.fcgi is lacking the executable bit.
41 You can set it using `chmod a+x index.fcgi`.