Mass checking websites for PHP errors

After PHP versions 5.6 and 7.0 became unsupported, I decided to write a small script in Python that can go through urls defined in sitelist.txt or whatever you wish to use.

I suggest you add urls based on your sitemap so you can check not only the frontpage for possible errors. Sitemaps, if automatically generated are usually available in domain.tld/sitemap.xml or other configured location by CMS.


Add urls into sitelist.txt like this:

Edit line 19 to adjust your error catching parameters. I’ve already included the most common PHP error messages and “php on line” should catch pretty much anything.


The script states when it has found a match in page source code and gives this output to the console. There are some exceptions in place you have some other configuration errors in the website.

More advanced testing

If you need something more serious you could e.g. use the Selenium framework for that purpose to do some real automated testing and even test the website functionality.

Leave a Reply

Your email address will not be published. Required fields are marked *