Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error logs to a file 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Hi Guys
I am trying to trap errors in a remote process.
Run normally my script is ok but when run from the client it produces no output. I have this code at the top of my script,
Code:
ini_set('display_errors',1); 
error_reporting(E_ALL|E_STRICT);

which is ok when a script is run normally but as the process does not write to the browser I need to see what is going on.
Is there a way to write the errors generated by the code above, to a txt file.
I am on a shared server with no root access.
Thanks

Keith
 
You can use ini_set to set the log_errors, and error_log configuration entries so you can have it log to a file you specify.

Though you should remember that using ini_set only works as long as errors are not fatal.

Otherwise the script is not run at all, and ini_set is not executed.

Code:
ini_set('log_errors','On');
ini_set('error_log','myfile.log');

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Tried on a normal script first with
Code:
ini_set('log_errors','On');
ini_set('error_log','zoom.txt');
and introduced an error.
Messages echoed to screen but not to file.
Even created a blank file but it remains empty.

Keith
 
Try setting log_errors to 1 instead of on.

And make sure there is access to wherever the file is.
The error log must be in a location that is writeable to the user the web server runs as.

And errors can't be fatal, so what kind of error did you introduce?


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks Phil, it was a permissions issue.
It works ok with 'on'.
Problem now is my script is not throwing an error, I can feel another thread coming on.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top