mr_zhang Posted July 12, 2007 Share Posted July 12, 2007 Hi guys, I understand that we can log on to our host and download the access.log and error.log (or similar file) for our website. Is there a certain path where I can access those logs without actually logging in to host control panel? I mean, is there a path where my program can get those files without downloading it to my computer? Regards, Quote Link to comment Share on other sites More sharing options...
btherl Posted July 12, 2007 Share Posted July 12, 2007 Often it's in /var/log or /var/log/apache. Your hosting provider is best placed to help you with that, as it can vary from system to system. You can also try looking in the apache configuration, usually found in /etc/apache, as the log location will usually be defined there. Quote Link to comment Share on other sites More sharing options...
mr_zhang Posted July 13, 2007 Author Share Posted July 13, 2007 Ok, thanks. But, how to access that path? Is it something like: fopen("http://www.site.com/var/log/error.log","r"); Won't it give a file/directory not found error? Regards, Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 13, 2007 Share Posted July 13, 2007 Ok, thanks. But, how to access that path? Is it something like: fopen("http://www.site.com/var/log/error.log","r"); Won't it give a file/directory not found error? Regards, Try: <?php $log = shell_exec("more /var/log/error.log"); ?> Quote Link to comment Share on other sites More sharing options...
mr_zhang Posted July 13, 2007 Author Share Posted July 13, 2007 Thanks infid3l, That's great, it seems to be what I'm looking for. I'll try it. However, it brings me to another questions: - If I have several domains in several hostings, do I have to put the script on each and every domain? - or just each and every host? If so, how to determine which error log belongs to which domain? - Could I just put the script on 1 domain and let the script get all the error logs from all domains (which are in different hosting companies)? If so, how to do that? I mean how to determine the domains? Regards, Quote Link to comment 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.