I understand that PHP's mysql_*
functions are deprecated and I should not be using them.
However, we have several legacy MySQL 4.0 databases, which neither the mysqli_*
nor PDO
functions support connecting to. What is the best way to continue using the latest PHP versions and still be able to connect to these databases?
(Based on the description at the top of the PDO intro page, I initially thought PDO might be an option, but the Changelog further down the page suggests that support for pre-4.1 has been dropped in PHP 5.4)
I understand that MySQL 4.0 is 10 years old and the real problem here is that we're still using it. Upgrading MySQL is a separate issue that's outside the scope of both my influence and this question. What I do have control over is the PHP version that we use - and I'd hate to have to stop upgrading PHP just because we need to connect to some old databases.
Even PDO will no longer connect to these old MySQL servers.
I should also clarify that we have several legacy applications accessing these databases, and we want to change these applications as little as possible. They are not in active development, and testing a change that involved rewriting large sections of code would quickly balloon into a rather large QA project.
For this reason, invasive solutions such as rewriting the code or upgrading the MySQL version, are highly unlikely to be worthwhile. If they are the only solutions available, we'll probably end up doing nothing - using mysql_*
as long as possible, and then freezing the PHP version (at least for these apps) as soon as the latest PHP can no longer connect.
On the other hand, technically complex solutions (such as compiling something from scratch) are definitely possible, and are actually preferred to making extensive code changes.