Author: Manuel Lemos
Updated on: 2011-07-15
Posted on: 2011-07-15
Categories: PHP community, PHP opinions
If you are using MySQL in your PHP applications for a long time, this may seriously affect you.
Read this article to learn what this means in practice and what you can do about it.
The PHP 5 adoption fiasco all over again?
Yes, you read it right. Recently, Phillip Olson sent to the PHP internals mailing list a proposal to kill the original PHP MySQL extension in future PHP versions.
Well, as you may have read, the idea is not to kill this very popular PHP extension right now in the upcoming PHP 5.4.
The idea is to first mark its functions as deprecated in the PHP documentation. The intention is to educate PHP developers to migrate their code to use the mysqli or the PDO extensions instead, or the mysqlnd, why not?
In future versions, say PHP 5.5 or 5.6 common calls to functions like mysql_pconnect, mysql_query, etc.. will throw ugly E_DEPRECATED notices. And eventually in PHP 6 or later, if it will ever happen, code that uses those functions will be removed from the main PHP distribution permanently.
The PHP 5 adoption fiasco all over again?
Well, you know, despite PHP 5.0 was released in 2004, it was not until 2008 when PHP 4 was officially considered discontinued, that it started gaining serious adoption. Despite PHP 5 contained a plethora of new features, many, many PHP developers refused to upgrade from PHP 4 to PHP 5 until they were forced to do it.
PHP 5 was mostly backwards compatible with PHP 4. So what was wrong with PHP 5? Many details, but I think I can sum it up to not being 100.0% compatible with PHP 4. Nobody wants to change code that just works.
In many cases, code that was running well in PHP 4, would still run well on PHP 5, except that it would probably throw many deprecated syntax notices that only seems to make it look like the code was wrong, despite there was nothing wrong about it.
One of the most famous cases of those misleading notices was the use of the var declarations. PHP core developers wanted everybody to replace var class variable declarations with public declarations.
You may ask: what was the point of that? In my opinion, none. So why it was imposed? Because PHP 5 is a so called "more object-oriented" version of PHP. It introduced the private and protected declarations, so the old var declarations should be replaced with public to be more consistent. Be more consistent with what? Java, I suppose. But PHP is not Java.
Anyway, since the idea was really pointless and it was doing more harm than good to the PHP 5 adoption, those notices ended up being dropped.
So, is this PHP mysql extension deprecation really necessary. I don't think so, but that is just my opinion. At most it will avoid the need to maintain the documentation of multiple extensions to access MySQL databases.
So, for the PHP developers that have old code to access MySQL databases this idea will not be beneficial at all. Once the deprecation becomes official, it will start annoying PHP developers that do not want to waste time rewriting code that always worked for many years.
So I am afraid the first PHP version that introduces this deprecation will suffer from the same adoption delay problems as PHP 5.
You may argue that the ereg extension is now being deprecated in favor of the preg extension for performing operations with regular expressions. Except that it was for a good reason: the preg extension is much faster because it compiles the regular expressions and caches the compiled results, so subsequent requests that use the same regular expressions do not have to waste time parsing and compiling them again.
What about you? Are you in favor or against this deprecation and discontinuation of the traditional PHP MySQL extension? Do you have large chunks of code that you do not want to bother to rewrite because of this plot to kill the mysql extension? Will you still upgrade to a new PHP version that deprecates or kills this extension? Feel free to post your thoughts here.
You need to be a registered user or login to post a comment
1,528,574 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
10. PHP: MySQL Extension will be eliminated! (Indonesian) (2011-07-21 20:36)
If there is a particular web developers and PHP developers often use MySQL, must know the function mysql_connect, mysql_query, etc..
9. The extension will be removed from PHP MySQL? (Italian) (2011-07-21 12:22)
The news spread after an intervention by Phillip Olson to the mailing list of PHP developers , the title of the message is clear: " deprecating ext / mysql ", even if the content of the email shows the need to focus on a more "soft" can be important (and drastic) proposal made...
8. PHP mysql extension plan will be killde (Indonesian) (2011-07-18 08:23)
A nightmare would happen if this occurred (will occur), as I quoted here...
7. Will the PHP MySQL extension die gracefully? (2011-07-17 21:36)
PHP core developers are planning to kill the PHP original mysql extension. The alternatives proposed are mysqli, PDO, or mysqlnd extensions. What does this mean for long time users of the trusty and dated mysql extension? Will we all have to migrate our code in a hurry?...
6. Out With The Old, In With The New: Original MySQL Extension Heading For Retirement? (2011-07-16 05:41)
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)...
5. Planean “matar” la extension MySQL de PHP (2011-07-16 02:29)
Sin duda una de las noticias más interesantes que he podido leer en estos días y que va a afectar a gran cantidad de desarrolladores de páginas web es aquella que trata sobre que los desarrolladores de PHP estuvieran barajando la idea de quitar la extesión actual que utilizamos para conectarnos a MySQL...
4. There’s a reason PHP “lives in the past” (2011-07-15 17:37)
One of the reasons PHP has a completely awful reputation is that a not-inconsequential number of its core users – people either with commit karma or enough pull to influence decisions on internals – revere backwards compatibility as the most holy thing...
3. NEWS: The Plot to Kill PHP MySQL Extention (2011-07-15 07:49)
I came accross an interesting announcement on PHP Classes this morning:...
2. No More PHP MySQL Extension? (2011-07-15 04:32)
I just finished reading an article over at phpclasses.org that talks about “the plot to kill the PHP MySQL Extension”...
1. L’estensione MySQL verrà rimossa da PHP? (2011-07-15 03:05)
La notizia si è diffusa in seguito ad un intervento di Phillip Olson nella mailing list degli sviluppatori di PHP; il titolo del messaggio parla chiaro: “deprecating ext/mysql“, anche se dal contenuto della mail si evince la necessità di privilegiare un approccio più “morbido” possibile all’importante (e drastica) proposta effettuata...