Skip to main content

Blog Post

Getting your Drupal 6 site ready to run on PHP 5.6

by Michelle Cox
July 22, 2015

The Drop isn't the only thing that is moving; so is PHP. If you have a Drupal 6 site you are most likely running PHP 5.3 or older, versions that stopped being supported in 2014 or prior. Now that PHP 5.5 has moved out of active support, some hosts, such as Acquia, are dropping support for anything older and sites will be forced to upgrade, ready or not. The good news is that Drupal 6 can be made to work with PHP 5.6, which is actively supported. Drupal 6 core needs just a few patches but many contributed modules will need to be updated and/or patched.


So what patches and updates does your site need? To find out, you first want to get a list of what errors your site is producing now. If you have dblog running and your watchdog table is empty, you can skip this step. If your site is like most, though, there are a bunch of little errors that will fill the logs and make it difficult to see what problems the upgrade is causing. To make a baseline list:

  • Make sure the dblog module is enabled.
  • Truncate the watchdog table to clear out old errors so we just have the current ones. (Be sure to keep a backup if you have a need for the original error log.)
  • Spider the site as an admin to hit all of the pages, including the admin section. I used wget for it following these instructions from jesstess:
    wget --post-data='edit-name=USERNAME&edit-pass=PASSWORD&next=' --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM/user
    wget -R logout -r --spider --load-cookies=cookies.txt --save-cookies=cookies.txt --keep-session-cookies http://EXAMPLE.COM


  • Try out some manual things that the spider won't hit like saving a node or editing an existing one.
  • Put this script into a text file called watchdog_distinct.php (you will need to add an opening php tag at the top):
    $result = db_query("SELECT DISTINCT message, variables, location FROM {watchdog} WHERE type = 'php' GROUP BY message, variables");
    while ($row = db_fetch_object($result)) {
      if (isset($row->message) && isset($row->variables)) {
        if ($row->variables === 'N;') {
          $message = $row->message;
        else {
          $message = t($row->message, unserialize($row->variables));
        drush_print($row->location . ' ~ ' . $message);


  • Run the following command via your terminal or command prompt (note: requires the Drush system to be installed):
    drush scr watchdog_distinct.php > current_errors.txt


The text file, current_errors.txt will now contain a list of the errors your site is currently having that you can compare against.


Now that you have a baseline to compare against, it's time to upgrade and find out what breaks. Do the following steps on a development copy of your site.

  • (optional) Upgrade core and contrib to the newest versions. This isn't strictly required and you could get by only upgrading those that turn out to need an upgrade to work with PHP 5.6. However, this is a good time to get your site completely up to date and the newest versions of contrib modules are most likely to have the necessary fixes.
  • Apply known patches to the modules you are using. See the references section below for links to the three PHP upgrade issue tags on
  • Set your development site to run on PHP 5.6.
  • Go through the same process as above with truncating watchdog, spidering, and running the script, but give the results text file a new name.
  • Compare the errors in the new text file to those in the old one to see what is broken that wasn't broken before.
  • For each of the errors, check for patches or write your own. Make sure to contribute back any patches you make and to tag them with the PHP version number to help others find them.
  • Repeat the testing, patching, and fixing until no new errors occur.
  • Give your site a good manual going over to spot anything the spider missed.

Once this process is completed with no new errors showing – congratulations, your site is now ready to handle PHP 5.6!


Meet team member, Michelle Cox

Michelle started using Drupal in 2005 with the 4.6 release. She spent the next seven years actively participating in the community by writing and maintaining three contributed modules, assisting in the forums and on IRC, and performing webmaster duties on the * sites. After a two year break to focus on photography, she came back to Drupal and contributes to the community by helping with webmaster tasks and working with her co-maintainers on her contributed modules.

Michelle first discovered her love of programming by writing BASIC programs on her Commodore 64 as a teen. While working toward her BS in computer science at University of Wisconsin - La Crosse
, she started work as a Visual Foxpro developer and continued to work in VFP until 2004. She kept programming as a hobby when she left the professional world to take care of her two boys. Michelle  discovered Drupal while working on her family website and quickly fell in love with both the software and the community. Prior to Mediacurrent, she developed a local community social networking site and wrote the Advanced Forum, Author Pane, and Advanced Profile Kit modules.

In addition to being a coder, Michelle is a mom, photographer, and Whovian. Percentages vary.

Learn more about Michelle >

Related Insights