Pregunta

This is something that has been bothering me for a while now and I'm sure there's a simple solution.

So my basic page structure starts like this with the every page file first and the header second.

require_once '../private/core/ep.php';
include template('header');

the ep file contains autoincludes for classes and functions, so everything inside of there occurs above the header. Whenever errors occur internally I often have to inspect the elements in my browser and navigate through the HTML to find what the error is which is really time consuming. Is there anyway around this?

¿Fue útil?

Solución

There are a few things you can do to keep your errors from showing up in your header. If you have access to make changes to your php.ini you can configure your error log so that all of your php errors can be logged there and set display errors to false. These can also be set in your ep.php file at the very top using the ini_set function.

Another solution is to configure your own error handler using http://www.php.net/manual/en/function.set-error-handler.php

You can then open a terminal and use "tail -f /my/log/file/location" to actively monitor your errors.

Otros consejos

You could write a LOG function to a file or better to a database. You will see exactly where your code broke.

Another thing you can try in enable error reporting on your server (php.ini)

I don't think there is any other way.

Ovidiu

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top