Server Forbidden 500 error when saving in Joomla Admin backend

I had been driven crazy recently by couple of my sites suddenly beginning to exhibit a very annoying behavior. Sites, which worked flawlessly over past months/years began to die when I tried to save something, from new or edited articles, modules, menu items, contacts.

Of course the first thing I done was to look to the error logs, then to enable debug and set the error reporting level to maximum. Nothing helpful.

Then I searched hours on web for clues, and found tons of articles and forum entries, and none lead me closer to a solution. But a seemingly weird question on one of forum entries made me to think and to check...

The respective forum entry (a response to a help request) was asking, if the database collation settings are correct.

Since these sites (Joomla 1.7, Joomla 2.5 and even a Joomla 3.1 site) where all migrated from some previous Joomla version, this question sparkled an idea - and I have gone checking things there.

And the clue proved to be a great one: all of the sites had some sort of problems regarding this. Some of them have database tables with mixed collation types - instead of the recommended collation type:

utf8_general_ci

Some tables had exotic settings, most of them latin1_swedish_ci was the most common one, the inherited default settings from my old host. Fixing these solved the problem for most of the sites, but for my own site. This apparently has the correct setting: all the tables had the recommended collation:

utf8_general_ci

I tried out many other recommended things, none helped, until I decided to take a closer look to the database itself. and here was the surprise: despite the fact, that the site was created by using the latest, most popular Joomla migration tool, and all the database tables had the correct collation, the database itself, for some reason was set to the infamous latin1_swedish_ci collation. Changing it to the recommended value solved the problem - and saved the day.

So, if you see that nasty Server 500 error when save something in your Admin backend try this tip too. Might save your day too!