crosenblum
crosenblum

Reputation: 1927

Can php page access/view mysql log files?

I am trying to get php to view/access the mysql error logs.

Can php in any way determine where the error log file is stored?

Is there some setting it can read to find that out?

My purpose is to create a log viewer, for multiple types of logs, and one of my needs is to view the variety of mysql logs.

But I don't want to have to manually configure folder path locations, and especially if this code is to be run on a shared server somewhere, I don't want to cause any security problems/issues.

Is there a safe way to determine the log files location automatically from with in php?

Thank you

Upvotes: 0

Views: 229

Answers (2)

Kancho Iliev
Kancho Iliev

Reputation: 701

I think the answer is NO. To do this you need to have access for reading for directory where MySQL stores logs. That path is configured in my.cnf or set like a parameter in it's start. I don't think any shared host will let you to look in this file. Also they don't let you look on mysql logs at all, because it is private information. No one will let you to look in queries of all their clients. Of course if it is your own host - you can do what you like and in that case you'll got many ways to do it.

Upvotes: 1

Quy
Quy

Reputation: 29

No, you can't. If you can, PHP is too dangerous ;)

Upvotes: 0

Related Questions