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’);
error_reporting(E_ALL);
phppinfo();
?>

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
Attachments
There are no attachments for this article.
Related Articles
Where can I find the PHP manual?
Viewed 1500 times since Tue, Nov 18, 2008
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 1714 times since Tue, Nov 18, 2008
Install Joomla 2.5
Viewed 11158 times since Mon, Apr 30, 2012
How do I send mail from my website using PHP?
Viewed 11745 times since Mon, Nov 9, 2009
How do I recognize PHP pages/scripts?
Viewed 2543 times since Tue, Nov 18, 2008
Is ionCube Encoder/Loader supported?
Viewed 1764 times since Thu, Jul 19, 2012
Are PDO and SQLite supported on the shared hosting?
Viewed 1980 times since Tue, Jul 24, 2012
Is Zend Guard/Optimizer supported?
Viewed 1153 times since Mon, Jul 23, 2012
Which PHP version is installed on the server? Which modules are available?
Viewed 2720 times since Tue, Nov 18, 2008
What is PHP?
Viewed 2052 times since Thu, Nov 27, 2008