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 12648 times since Mon, Nov 9, 2009
How does the connection between PHP and MSSQL work?
Viewed 6943 times since Mon, Jul 23, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 2408 times since Tue, Jul 24, 2012
Which PHP version is installed on the server? Which modules are available?
Viewed 2865 times since Tue, Nov 18, 2008
What is PHP?
Viewed 3553 times since Thu, Nov 27, 2008
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 2029 times since Tue, Nov 18, 2008
Is Zend Engine supported?
Viewed 3054 times since Mon, Jul 23, 2012
Install Joomla 2.5
Viewed 11491 times since Mon, Apr 30, 2012
How do I hide any PHP errors on my website?
Viewed 1146 times since Tue, Jul 24, 2012
How do I recognize PHP pages/scripts?
Viewed 4971 times since Tue, Nov 18, 2008