Legacy Datasource Drivers for MySQL and MySQLi for CakePHP 2.x

You know how it works. You are developing your toy… having lot of fun…. adding awesome features and your child is growing and growing and you are getting prouder and prouder. But then the evil customer comes and wants something else. “No problem”, are your first thoughts. The design is good and you were thinking always couple steps in the future, making your application extensible… awesome. But then its not enough for the evil customer to want lot and lot more features, for irrational little time and basically no money. It always starts with a suggestion… or a very polite request. And ends with a major change in the whole architecture. You basically end up with a handicapped child. And you are left to take care of it for the rest of your never ending nights.

Recently ran into a problem while developing my “awesome” CMS where the customer needed a major change in the current architecture. Because the change was extensive I decided to migrate my CMS from CakePHP 1.3 to 2.1 and save a bit of effort I would have been doing if I did those refactoring steps separately. I loooong night and the migration was done. Fortunately there is a very nice (even if not complete) migration guide. During this procedure I even was able to clean up my code a bit, refactor even some other stuff so at the end of the whole process I was really satisfied.

But than…. wait for it….

… the database was not working. I got an “Error: Database connection “Mysql” is missing, or could not be created” error. The answer was found pretty quick… since the solution is easy. Of course I check all the web servers before I started the migration. All of them had PHP version greater than 5.2.something, where something > 8, which is according to the migration guide the minimum version CakePHP 2.0 is running on. But I forgot to check all the extensions, DB versions, Apache version and extensions with versions and don’t forget about the kernel the server is running on. I was a bit naive and thought that since PDO ships with PHP 5.1, it will be there and if not enabled, enabling it will not be such an issue.

After couple requests to the webhosting providers I had 3 options:

Be my guests to use them, fix them, update them, fork them or wherever your imagination drives you. They seem to be working… depends how much I can still see at this time. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *