Telenet Cloud Online Help

How do I track problems in my PHP website?

Because of security reasons we don’t display PHP errors to the visitor on our shared environments. Due to the structure of our environment it is not possible to log default PHP errors, as we are doing now for visitors and apache error logs.

We can always change your PHP settings (php.ini), but this is a billing service and it is not always the best solution during the development phase.

To solve the problem, a piece of PHP code may be added to your .PHP files causing the problems. In the code you can still choose to display an error page to the visitor or to log errors to a file, or you can opt for a combination.

In the example below, this is shown through an incorrect PHPinfo function; this can be applied to each .PHP file. Be sure to put it at the top of the page, after the "

undefined undefined undefined undefined
ini_set(’display_errors’, 0);
ini_set(’log_errors’, 1);
ini_set(’error_log’, dirname(__FILE__) . ’/error_log.txt’);

In this example no error page is displayed to the visitors (display_errors has value 0), but the errors are logged to a file (log_errors has value 1 and in the line below the log file is named error_log.txt in the current folder).

0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
Related Articles
How do I send mail from my website using PHP?
Viewed 11659 times since Mon, Nov 9, 2009
Is ionCube Encoder/Loader supported?
Viewed 1709 times since Thu, Jul 19, 2012
What is PHP?
Viewed 1857 times since Thu, Nov 27, 2008
How do I recognize PHP pages/scripts?
Viewed 2510 times since Tue, Nov 18, 2008
How do I hide any PHP errors on my website?
Viewed 928 times since Tue, Jul 24, 2012
Is Zend Engine supported?
Viewed 2767 times since Mon, Jul 23, 2012
Which PHP version is installed on the server? Which modules are available?
Viewed 2690 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 10937 times since Mon, Apr 30, 2012
How does the connection between PHP and MSSQL work?
Viewed 3350 times since Mon, Jul 23, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 1950 times since Tue, Jul 24, 2012