We had a challenge with one of our Client’s Live site going down if we create/edit a content, or clear the cache or simply do any tasks that affected the Database. So, every time this happened we need to request the Hosting Company to restore the site with the previous working backup. However, images were not displaying and pop-up functionality was not working properly across the site after restoration.
We then set-up the instance on our Dev environment with the same Live server configuration to troubleshoot the issue.
Below are some of the steps we had in place to identify the problem:
- Registry rebuild
- Clear cache through Drush
- Comparing Live VS Dev files to find out any malicious files are there
- Comparing Live VS Dev databases
- Core update
- Server scan [Sucuri tool]
- Sanitization [ Disable all dev modules & unused modules]
- Version upgrade of server
- Checking cron
Luckily, our first step ‘Registry rebuild’ through Drush, fixed the problem on our Dev.
Here is what we got as a response when we rebuilt the registry through Drush:
“Manually deleted 1 stale file from the registry. [success]
A file has been declared in a module's .info, but could not be found. This is probably indicative of a bug. The missing file is [warning]
All caches have been cleared with drush_registry_rebuild_cc_all. [success]
All registry rebuilds have been completed. [success]”
We found the missing file issue from the above result and copied the missing file from the previous [7.x-1.0] package to fix the issue permanently.
We were then ready to apply the same steps on the Live. As a first step we rebuilt the registry and checked the Live site’s status. Unfortunately, it didn’t work for us. Live Site went down again!
We didn’t have any clue as ‘error reporting’ code also was not working on the site. Upon further checking, we found some of the admin back-end pages were still accessible. And we went through all the admin pages. And when we checked the ‘Recent Log messages’ page - WSOD [White Screen Of Death] where the following error had displayed:
“PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table image_dimensions doesn't exist”.
a. As the error itself was self-explanatory, we checked the Database and found that ‘image_dimensions’ table was not there. So, we tried to create that table manually through PHPMyAdmin and run the database updates.
b. DB query that we used to create the table:
CREATE TABLE `image_dimensions` (
`fid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'File ID.',
`height` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The height of the image in pixels.',
`width` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'The width of the image in pixels.',
PRIMARY KEY (`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Cache images dimensions.';
c. But that didn’t fix the issue completely...hmmm
a. We went back and analysed the past changes on the site and found that ‘File entity’ module was not configured properly and could have even been broken. If that was the case, Drupal 7 updates using update.php may not have triggered the update_7101 which was recently added in the newer version of ‘File entity’ module and hence image_dimensions table may not have created.
b. So, we decided to update the schema version manually
c. Updated the schema version by using the following DB query:
update system set schema_version = '7100' where name = 'file_entity';
d. This also didn’t fix the issue as File entity schema was not updated properly...hmmm
1. So, we tried to do the File Entity - Schema update through code:
2. We added the following code in .module file.
// Bootstrap drupal... (or use drush scr)
3. And run update.php again.
4. Bingo!!! It worked! :-)
After a detailed analysis, the root cause was that File Entity module had been installed first, but then Media 7.1.x was installed again which consists of File Entity as sub-module in the newer version.
So, if you had installed File Entity module already on the website, please uninstall before installing Media 7.1.x
Always when you work on site down issue, follow the WSOD - Drupal suggestions and work your way up in ruling out problems one after the other...most importantly be patient. There is solution out there, you just need to find that out, and you will if you patiently go after to rule out all known issues.
Find out how our expert Drupal website maintenance team can help optimize your website! Get in touch with us today!
Call Drupal Geeks @ 312-340-7112 or send an email to [email protected];