PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Out With The Old, In With The New: Original MySQL Extension Heading For Retirement?

Note: This article was originally published at Planet PHP on 16 July 2011.
Planet PHP


Image via Wikipedia

When we use the term PHP, we are often silently associating it with the abbreviation LAMP (that's Linux, Apache, MySQL and PHP just in case you don't recall). MySQL has been our bread and butter in PHP for over a decade; an old friend, accomplice and partner in crime. This was made possible with the MySQL extension. Indeed, you can scarcely find a basic nuts and bolts PHP tutorial that doesn't use MySQL. Which is probably why it's a good idea to give it a huge going away bash (and make sure it finds the exit afterwards and catches a cab to oblivion!). We've since seen replacements like the MySQL Improved extension (mysqli), PHP Data Objects (PDO) and the MySQL Native Driver (mysqlnd). These are simply better from the additional features each adds to their integration in higher level libraries such as Doctrine.

But, as with any basic change to a successful formula, there was bound to be some controversy at the mere suggestion of deprecating our old friend (even if preceded by an extended period of educating users on the well established replacements). Manuel Limos and Lucas Darnell have both written blog posts indicating what a bad idea this could be. Their issues are understandable. Once the E_DEPRECATION notices start flying applications that have existed for years (and years) will appear to implode leaving behind a long line of irritated people who may need to hire a PHP programmer to fix stuff. This obviously imposes a cash cost across thousands (probably an underestimation) of businesses. This may lead to hosting services deferring adoption of the PHP version carrying the deprecation by months if not years. Lucas also raised an interesting point that with so much literature, including books, carrying example after example of (often insecure in my opinion) MySQL extension use, user adoption and education may suffer a great deal.

In a riposte to Manual Lemos, Gregg Thomason perhaps illustrates best why even the feared disadvantages may be worth the cost. MySQL is a historical relic from a past PHP is trying to leave behind. It's old, doesn't do a lot to support security and it needs to go. I agree. Gregg says aoathis is a forward-thinking business and our job is to invent the future.a Let's go invent and improve that future - if nothing else it might make Anonymous' job finding SQL injections at every company they squint at a little harder .

PHP is not a weirdo stagnant programming language used by amateurs who don't have sufficient brain cells to learn Java, Ruby or Python. That's the common misconception based largely on two obvious factors: PHP is so amazingly popular and easy to learn that any innocently ignorant person with half a brain cell can write a fabulously insecure application (the examples just keep coming and coming) and, secondly, PHP is a bit on the ugly side and not a aotrue object oriented languagea because

Truncated by Planet PHP, read more at the original (another 1254 bytes)