Frontend Debugging Tips

This page details tips about debugging Savannah frontend (PHP code and such).

It is highly recommended to debug new features on a dedicated FrontEndDevelopmentSite or when RunningSavaneLocally. Avoid meddling with the real public website as much as possible.

PHP debugging

Showing PHP messages + SQL statements in the web browser

In the savane.conf.php file, set (or uncomment) $sys_debug_on=true.

This option will add to the bottom of every rendered HTML page the list of all SQL commands with source code information, and all POST/GET/COOKIES values.

Call util_debug("hello world"); to print additional messages at the bottom of the rendered HTML page (e.g. 'debug-by-printf').

To print a variable, call util_debug(print_r($VAR,TRUE));.

Print messages to Apache log

In the PHP code, call error_log("hello world"); to send the message to Apache log (note: it will be the error log or PHP log, depending on your configuration. See details below).

To print a variable, call error_log(print_r($VAR,TRUE));.

Dedicated Development Site

For website setup according to FrontEndDevelopmentSite, the relevant locations are:

  • access log: /home/[USER]/savannah/var/[USER].access.log.
  • error log (STDERR): /home/[USER]/savannah/var/[USER].error.log.
  • PHP error messages: /home/[USER]/savannah/var/[USER].php-error.log.
  • group registration submissions: /home/[USER]/savannah/var/www/submissions_uploads.
  • tracker file attachments: /home/[USER]/savannah/var/lib/savane/trackers_attachments.
  • mail logs: /var/log/mail.log (Same as the real system, see MailSystem). See FrontEndNotificationEmails for information about setting up email notifications during development.

  • cron jobs: (FIXME)

Local Savannah Site

When RunningSavaneLocally, the following are used:

FIXME.

  • access log:
  • error log (STDERR):
  • PHP error messages:
  • group registration submissions:
  • tracker file attachments:
  • mail logs: (not sent? depending on local PHP settings?)
  • cron jobs: (no cron jobs)

Public website

The following files and directories are used by the public website (which serves https://savannah.gnu.org).

  • access log: /var/log/apache2/access.log.
  • error log (STDERR): /var/log/apache2/error.log (FIXME: verify).
  • PHP error messages: same as error log (no separate PHP log for public website).
  • group registration submissions: /var/www/submissions_uploads.
  • tracker file attachments: /var/lib/savane/trackers_attachments.
  • mail logs: /var/log/mail.log (see MailSystem).
  • cron jobs: (FIXME)