Frequently asked questions

Back
How can I see PHP errors/debug PHP code?
This answer is directed to advanced users, technicians and programmers.

Regrettably, we cannot provide support for such programming.

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


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.

Testing with your own php.ini

To test your own php.ini on the command line, you must tell PHP to use it. The example below assumes you use bash as your shell and that php.ini is in your home directory.

export PHPRC=$HOME/

You must do this before you run your php program, but it is only necessary at the start of each login session. You may also add it to your .bashrc if you don't want to run the command every login.


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.


Direct display of errors

If you enable code>display_errors and display_startup_errors, errors will be displayed directly in your browser or on the command line (see below), if possible.

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

In .user.ini:

display_errors = 1
display_startup_errors = On

Testing on your own/external webserver

If you wish to test PHP on your own webserver or a webserver hosted by another provider, it needs to be configured similarly. Please note the following elements, which may be different from other setups:

PHP 5.6

  • Operating system: Debian Jessie, 64-bit x86
  • Webserver: Apache 2.4
  • Modules: ModSecurity, mod_evasive, mod_access_compat
  • PHP 5.6 vassal under uWSGI emperor
  • Our php.ini, but see also phpinfo() for details.

PHP 7.0

  • Operating system: Debian Stretch, 64-bit x86
  • Webserver: Apache 2.4
  • Modules: ModSecurity, mod_evasive, mod_access_compat
  • PHP 7.0 vassal under uWSGI emperor
  • Our php.ini, but see also phpinfo() for details.

There may be other differences, we are not familiar with all other configurations. We do not provide support for configuring your own webserver or other webservers.


See also:

Keyword:  

Index

© 2017 Domeneshop AS · About us · Terms & Conditions · About cookies