runnerjp Posted March 24, 2010 Share Posted March 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/ Share on other sites More sharing options...
trq Posted March 24, 2010 Share Posted March 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031258 Share on other sites More sharing options...
runnerjp Posted March 24, 2010 Author Share Posted March 24, 2010 hum i still would'nt mind adding a log to my database Thorpe. Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031263 Share on other sites More sharing options...
trq Posted March 24, 2010 Share Posted March 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031268 Share on other sites More sharing options...
runnerjp Posted March 24, 2010 Author Share Posted March 24, 2010 well really i just want to get the error, find out who caused it and where and just show them a message like "you have made an error" without showing the actuall error. Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031277 Share on other sites More sharing options...
greatstar00 Posted March 24, 2010 Share Posted March 24, 2010 not "you have made an error" it should be "The server encountered an error" cause not all error is made by users. read this http://www.php.net/manual/en/function.set-error-handler.php Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031297 Share on other sites More sharing options...
greatstar00 Posted March 24, 2010 Share Posted March 24, 2010 not "you have made an error" it should be "The server encountered an error" cause not all error is made by users. anyway, u cant handle syntax error like u mis typed a semicolon read this http://www.php.net/manual/en/function.set-error-handler.php Quote Link to comment https://forums.phpfreaks.com/topic/196412-error-logging/#findComment-1031298 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.