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 recognize PHP pages/scripts?
Viewed 2652 times since Tue, Nov 18, 2008
How do I send mail from my website using PHP?
Viewed 12259 times since Mon, Nov 9, 2009
How do I hide any PHP errors on my website?
Viewed 1050 times since Tue, Jul 24, 2012
Is Zend Engine supported?
Viewed 2942 times since Mon, Jul 23, 2012
Is ionCube Encoder/Loader supported?
Viewed 1885 times since Thu, Jul 19, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 2116 times since Tue, Jul 24, 2012
Where can I find the PHP manual?
Viewed 1590 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 11391 times since Mon, Apr 30, 2012
What is PHP?
Viewed 2286 times since Thu, Nov 27, 2008
Which PHP version is installed on the server? Which modules are available?
Viewed 2795 times since Tue, Nov 18, 2008