Skip to content


Easily View PHP Errors on Yahoo Business Hosting

I don’t often use Yahoo Business Hosting, but every once and a while I have a client who is already hosting their sites there. With all large monolithic hosting companies there are caveats to using their systems… PHP especially.

Yahoo Hosting does not support .htaccess files and does not allow display of PHP error messages directly in the pages. These are all well and good for the obvious security reasons. Yahoo does allow the logging of PHP errors if you follow their directions to enable it.

Once you enable the scripts log, lock down the directory so you must have a password to access. It doesn’t quite make sense to put the logs in a live web directory. It is trivial for any script kiddie to call up the script log errors in their browser by manually keying in the URL. Yahoo Hosting should make a bigger point of emphasizing securing this directory when it shows how to enable the scripts log.

Unfortunately, without console access there is no easy way to follow the log as one would normally do with tail. Directly loading the log in a browser can return a very long page with the most important information (ie. the last error encountered) at the very bottom of the page. I created a simple script called phperrors.php to make following the log easier. The script provides easy access to the errors log by refreshing automatically every 30 seconds and displaying only the last lines of the log with the newest ones on top. The refresh time is configurable and can be disabled. The number of lines listed may be set in the refresh form. Plus, the script is completely self-contained in a single file.

Installation / Usage

  1. Enable scripts.log as directed above from Yahoo’s support.
  2. Upload this file to the root of your hosting account.
  3. For security, rename this file to a long (at least 6 characters) random name
    that only you know. Something like:

    zx89adsf8-phperrors.php

    Don’t use my example name. That kind of defeats the purpose. I have included code to generate a random filename to use for renaming the file.

  4. Load the page in your browser.
  5. Bookmark the URL so you can find it again.
  6. Refresh browser as needed or select automatic refresh and hit Go.
  7. To stop automatic refresh uncheck refresh box and hit Go.
  8. To adjust the refresh rate adjust the $refresh_seconds variable below.
  9. If you find this script useful, buy me a beer by dropping a couple of bucks in my tip jar.

I realize renaming the file may be a moot point being that Yahoo allows direct access to the scripts log for anyone, but perpetuating poor security is never acceptable in my book. Perhaps some day soon, Yahoo will better emphasize how to protect this directory from everyone but the account owner.

Download: phperrors.php

Popularity: 35% [?]

Posted in Development, PHP.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.