Frequently asked questions

Back
Keyword:  

How can I see PHP errors/debug PHP code?

This answer is directed to users that wish to debug errors in their PHP software, such as Wordpress or Joomla.

Regrettably, we cannot provide support for such debugging/programming.

PHP has some internal mechanisms designed for debugging, here are a few tips to get started.


Activate display of PHP errors

Customers are able to enable PHP errors, which will be displayed directly in the browser.

This may be activated in the control panel:

  1. Log in to the control panel with your user account.
  2. Click My domains
  3. Click the relevant domain
  4. Click Web hosting at the top of the page
  5. Click View/Change to the right of PHP.
  6. Locate Display PHP errors and choose the desired level of reporting.
  7. Save the changes by clicking Change

Activate via .user.ini

Alternatively PHP errors may be activated through uploading a file on your web hosting. Create a file named .user.ini in your document root (usually the www folder) with the following contents:

display_errors = On
display_startup_errors = On

It may take up to ten minutes for the changes to take effect.

Use this functionality only for testing, as it may reveal secrets about your website, such as the database passord.


Logging to file

You do not have access to the webserver's error_log, but you may configure PHP to log its errors for you. See also our list of the most common error situations, it can save you a lot of work.

You may find detailed information about error logging in PHP in PHP's error function configuration documentation.

We also permit customers to perform some configuration changes via .user.ini, error logging is one of the possible configuration changes here.

error_log = /home/1/m/mydomain/php-error.log

This logging may slow down PHP a bit, and pay attention so that it doesn't consume all available space on the webhotel; remember to delete the file regularly.

PHP also has functionality for logging errors directly to an error log from your source code.

We recommend logging to a specific file, to avoid confusion with the error logging configured in .user.ini.

WordPress specific debugging

WordPress lets you toggle its own debugging mode in wp-config.php:

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

Change false to true to enable debugging messages.


Testing on our login server

As a customer with Webhotel Medium or greater, you also have Unix shell access on our login server. You may use this to test your PHP 5.5 software via the command line. Please be careful with your resource usage, the login server is used by many others.


See also:

© 2024 Domeneshop AS · About us · Terms · Privacy policy