We have a Drupal 7.12 Setup in production.

Recently we upgraded PHP to 5.4.10 and we are getting the following error,

PHP Fatal error: Cannot call overloaded function for non-object in /var/www/html/includes/database/query.inc on line 331

What can be the possible reason for it and how do can we solve it?

If the above information is not good enough to know about the root cause, how can some more data be logged about the error?

2 Answers 2


You have to configure apache correctly, edit apache config file:

vi httpd.conf

Add this line in config file:

CoreDumpDirectory /tmp/apache2-gdb-dump

Create the folder and set permissions:

mkdir -p /tmp/apache2-gdb-dump
chown httpd.httpd /tmp/apache2-gdb-dump
chmod 0777 /tmp/apache2-gdb-dump

Then restart apache

/etc/init.d/httpd restart

On the requirements page there is a "Version specific notes on PHP requirements" section that gives information on supported PHP versions.

Notice that it doesn't mention PHP 5.4 anywhere. I take this to mean that Drupal 7 is not guaranteed to work with PHP 5.4.

In addition to this there is no hard requirement for any contributed modules to support PHP 5.4 yet. Some modules will work and some will have problems. Some modules have already had these problems fixed and I have seen in some cases, maintainers saying they will not support 5.4 if the fix causes problems for older versions, because php 5.2 & 5.3 are the main target versions of Drupal 7.

I would recommend if possible to not use PHP 5.4, and if you do you will quite probably be having to debug more of these issues as you encounter them.

Also, your version of drupal is 10 versions (more than a year) old. If you want to use the cutting edge version of PHP you have to also use the latest versions of all modules as this will give you the best chance of these kinds of issues having been fixed.

Not to mention that there have been some security fixes since 7.12 that you would benefit from having.

Is it an option for you to stay on PHP 5.3?

  • We did a recent upgrade from 5.3 to 5.4, due to PHP-vulnerability test recommendations. This was on customer's request. It can't be reverted back. Also, it uses few custom modules just built to serve customer's requirements and they are tied to Drupal-7.
    – alampu
    Commented May 6, 2013 at 8:05
  • From a technical standpoint it can be reverted back, but maybe not if the client doesn't want to. However maybe it depends whether the client wants PHP 5.4 or a working site :) - I would suggest the first thing you do is update modules to the latest release. Especially drupal core to 7.22. I would say being on an out dated version of drupal modules is more of a security risk than being on PHP 5.3. The latest versions of modules should hopefully have fixed most PHP 5.4 issues. - Other people have apparently run drupal 7 with PHP 5.4.
    – rooby
    Commented May 6, 2013 at 12:01
  • I haven't seen other people complaining about this exact error so if upgrading drupal doesn't help then it could be a server config issue.
    – rooby
    Commented May 6, 2013 at 12:20
  • Ok. I think, I was not very clear in the question. The application is running and we are able use it. After running for more than 10 days, then users would face random issues like login-failure, logout-failure etc.. an apache restart will fix these. At this juncture we saw these logs.
    – alampu
    Commented May 6, 2013 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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