PHP核心开发者计划弃用原始php mysql扩展，如果你在自己的PHP程序中使用了原始PHP MySQL扩展，并且想使用很长一段时间，那么对你来说会有所影响。
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.