FrontEnd Debugging Tips

This page details tips about debugging savannah's frontend (PHP code and such).

It is hhighly recommended to debug/develop 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 on 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's log

In the php code, call error_log("hello world"); to send the message to apache's 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 websites 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.
  • project 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:
  • project registration submissions:
  • tracker file attachments:
  • mail logs: (not sent? depending on local PHP settings?)
  • cron jobs: (no cron jobs)

Public website

The following files/directories are used by the public website (which serves https://frontend0.savannah.gnu.org, and soon https://savannah.gnu.org when migration is completed).

  • access log: /var/log/apache/access.log.
  • error log (STDERR): /var/log/apache/error.log (FIXME: verify).
  • PHP error messages: same as error log (no separate PHP log for public website).
  • project 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)