1

Long ago I got a message about updates to my modules. I've updated the modules. But I received a message to update the database.

I want to run the update.php script but I encounter the following error message:

Server error.

The website encountered an error while retrieving http://MYSITE.COM/update.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later.

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

I do not remember which modules got updated. Please help me.

1
  • 1
    Can you have a look at your apache error logs in order to detect what the problem could be and post the error message in your question ?
    – tostinni
    Jan 4, 2012 at 19:09

3 Answers 3

1

First of all, in the future, always take backups, of both your code, and your modules, prior to updating, so you can easily revert in this type of situation.

Error 500 means that your webserver attempted to parse the code in your update.php file, but failed. The first thing you need to do, is check your servers error log, and find all error messages that are timestamped with the time of your last attempt to execute the script. If you don't know where the logs are, you need to ask your hosting provider.

Regardless of the error message, it could be worth replacing the files in your Drupal install with a fresh set. Download the latest version of your major Drupal version, and copy your sites directory over there. This could fix the problem for example if either your update.php file, or others that it depends upon, has become corrupted somehow.

2

The errors output to Apache are often somewhat cryptic.

You probably want to check the Drupal Reports page, dblog, and the Apache logs.

This sounds like one of the new updates has a problem in the .install or cannot be loaded (permission problems, although that comes proper from Drupal, I never had that problem on an upgrade.)

To test whether the PHP code is invalid, you can run

 php <filename>

The update.php will generate some errors, but it should not tell you it cannot parse it. All the module .install should not generate any errors (a very few modules have code outside functions and those will generate errors, but again no syntax error.) Those syntax error are reported by Apache.

1
  • Make sure to be logged in as user 1 before going to update.php.
  • Make sure update.php is in the drupal root directory.
  • Make sure update.php has correct permissions such as 755. (Credit arjan)
chmod 755 update.php
  • Make sure there aren't any .htaccess rules denying access to update.php
grep update .htaccess

I usually install drush and run updb in order to run all outstanding updates.

3
  • update.php is in the drupal root directory.but, how to check denying access by .htaccess? Jan 4, 2012 at 19:06
  • I would take Letharion's advice and verify the error log before reading through the sites .htaccess file. If you still want to verify the htaccess file I would start by looking in the drupal root directory for a file named .htaccess and search through for any lines referencing update.php
    – Ben Bunk
    Jan 4, 2012 at 19:11
  • Another idea is to check the file permissions of the update.php (and the document root folder). For example, if your document root folder has overly permissive settings (like 777) you often get a 500 internal server error.
    – arjan
    Jan 4, 2012 at 21:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.