PHP error pages

From Wikitech-static
Jump to navigation Jump to search

The wmerrors PHP extension displays pretty fatal error pages for PHP and let Wikimedia log a stack trace whenever it happens.

What lives where

/etc/php5/conf.d/wmerrors.ini on every Apache. Maintained in puppet.
Error page
the displayed error page is maintained in operations/mediawiki-config.git and is named php-fatal-error.html in . It is pulled on the deployment host and synced to Apaches as /apache/common/php-fatal-error.html
Log collector
udprec runs on fenari as nobody, listens on port 8421, writes to /var/log/mw/fatal.log
    • TODO: how is this collector managed?

How to ...

update the source code

$ git clone ssh://
$ cd wmerrors

// Edit package2.xml for new release

# pecl package package2.xml

Upload wmerrors-<version>.tgz to /home/wikipedia/src/pecl


  • pecl install /home/wikipedia/src/pecl/wmerrors-<version>.tgz
  • apache-stop ; sleep 3 ; apache-start

Using OS packaging would be a real headache for our mixed cluster, PECL's source-based distribution system is much simpler.

update the error page

The file is maintained in mediawiki/php/wmerrors.git repository under the name php-fatal-error.html. Simply make your changes there and deploy the file.