Forum Moderators: coopster
My problem is that I want to log details of each request and get these details into a MySQL database. It seems as if the logging directly to MySQL is causing it to overload.
I can not use the Apache Log files instead as some of the data I wish to log is only available when PHP is running.
I can not / will not change the max number of connections for MySQL.
Does anyone have any ideas on how I can write the logging script so that it does not need to connect to the database for every request?
you could also take a look at syslog [php.net]
you could also try a text file as a log and use a cron to move it in chunks to mysql
- SQL so that it is ready to go into the database (though I am not sure about new lines, or if this is secure)
- Serialized so that it can be deserialized as an object that adds itself to the database (one per line)
- CSV (comma separated) so that it takes up less room in the file, but I need to process it more.