Jump to content

Error logging


runnerjp

Recommended Posts

Hi,

 

I need to create a PHP script that writes php errors (Warning notices etc.) to  MySQLdatabase. I know PHP has a built in error log function but im on a shared hosting site and cant chnage these types of files nor have any access ot them. Any ideas where I could start?

 

I already have error reporting enabled at the start of my scripts,

 

PHP Code:

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
?>

 

The data i was thinkin of is:

Date/time

Page

error

Error line in code?

Ip of user

username

 

then if an error is added to db send me an email so i know.

 

Then rather then disply " there is an error in you syntax" ect it just prompts them to an error page of my own choosing.

 

This way i wont show information which could lead to security holes!

 

 

Thanks!

 

Jarratt.

Link to comment
Share on other sites

I need to create a PHP script that writes php errors (Warning notices etc.) to  MySQLdatabase. I know PHP has a built in error log function but im on a shared hosting site and cant chnage these types of files nor have any access ot them.

 

The location of your error log can be set quite simply within a .htaccess file or via ini_set. Obviously you didn't check the manual before posting this uneducated comment.

Link to comment
Share on other sites

I'm not sure how that is going to happen.

 

You may need to parse the error log and insert it into a database that way. Error logs should generally be kept very simple so as they don't create errors themselves.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.