Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been running a mediawiki server for many years now at my company. Recently to combat a problem I was having with PDF uploading when they contained metadata, I have moved to the latest revision of all the software on my Gentoo box (Mediawiki 1.18.1, PHP 5.4.0, PostgreSQL 9.1.3)

Now certain pages (two category pages which receive heavy usage) return the same PHP error.

Warning: Illegal string offset 'LIMIT' in /var/www/localhost/htdocs/includes/db/Database.php on line 1377

It then has 5 or 6 complaints about that error. Then comes the line:

Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/includes/resourceloader/ResourceLoaderWikiModule.php on line 177

Then says the whole thing is a mediawiki internal error.

It then tells me that the original exception:

Original exception: exception 'DBQueryError' with message 'A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: Query: SELECT COUNT(*) AS pages,COUNT( (CASE WHEN page_namespace=14 THEN 1 ELSE NULL END) ) AS subcats,COUNT( (CASE WHEN page_namespace=6 THEN 1 ELSE NULL END) ) AS files FROM "categorylinks","page" WHERE cl_to = 'Item_Groups' AND (page_id = cl_from) LOCK IN SHARE MODE
Function: Category::refreshCounts
Error: 1 ERROR: syntax error at or near "LOCK"
LINE 1: ...E cl_to = 'Item_Groups' AND (page_id = cl_from) LOCK IN SH...

I have gone into the database and have determined that when I run this same query from the database itself, I get the same error and same result.

And YES I have run the update.php function.

I tried a backdoor delete of the affected pages (manually applying the URL directly to the delete form). I then purged the database of all the archived pages (AKA, deleted pages) using the maintenance script. All to no avail. The database has some weird issue with these pages, and I cannot figure out how to purge them so that I can recreate them again!

share|improve this question
What versions of all the software you mentioned were you running before the upgrade? – Ladadadada Mar 7 '12 at 18:12
Postgresql 9.0, PHP 5.3 and Mediawiki 1.16.X (I dont recall the exact subvserion)! – dynamphorous Mar 7 '12 at 18:42
up vote 0 down vote accepted

OK, so I have solved the problem. It turns out that the problem is PHP 5.4.0. I downgraded to PHP 5.3.10 and the whole thing works perfectly again. For some reason version 5.4 causes there to be some sort of issues when interfacing with PostgreSQL.

If anyone knows the reason for this, I'm sure I'm not the only person who would appreciate knowing why this happens.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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