title: Connecting to old MySQL servers
body: <p>I understand that PHP's <code>mysql_*</code> functions are deprecated and <strong><a href="https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php">I should not be using them</a></strong>.</p>
  <p>However, we have several legacy MySQL 4.0 databases, which neither the <a href="http://ca1.php.net/manual/en/intro.mysqli.php" rel="nofollow noreferrer"><code>mysqli_*</code></a> nor <a href="http://ca1.php.net/manual/en/ref.pdo-mysql.php" rel="nofollow noreferrer"><code>PDO</code></a> 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?</p>
  <p>(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)</p>
  <p>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.</p>
  <p><strong>Even PDO will no longer connect</strong> to these old MySQL servers.</p>
  <p>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.</p>
  <p>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 <code>mysql_*</code> 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.</p>
  <p>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.</p>