Staticpage to Access error.log
- Wednesday, January 18 2006 @ 11:06 am EST
- Contributed by: Tony
- Views: 11,688
I've often needed access to my error.log from a machine that did not have an SSH client installed. I created this little hack that can live within a static page:
- Go to the staticpage admin screen and hit the "Create New" button.
- In the PHP drop-down be sure to select "execute PHP"
- For the group down-down, be sure to select "Root" and be sure to uncheck teh Read flag for Members and Anonymous (NOTE: this is important for security)
- In the "content" textarea add the following:
global $_CONF; require_once $_CONF['path_system'] . 'classes/downloader.class.php'; $dMgr = new downloader(); $dMgr->setPath($_CONF['path_log']); $dMgr->_setAvailableExtensions(array('log' => 'text/plain')); $dMgr->setAllowedExtensions(array('log' => 'text/plain')); $dMgr->downloadFile('error.log'); if ($dMgr->areErrors()) { $dMgr->printErrors(); }
- Save the page
That's it. Simple, elegant and as secure as Geeklog is.