Files
php-the-right-way/_posts/07-02-01-Databases_MySQL.md
Peter Kokot 4a3341dfc2 Reword mysql extension chapter
- The ext/mysql deprecation chapter has been removed from the PHP manual
2023-01-19 18:12:26 +01:00

1.7 KiB

isChild, title, anchor
isChild title anchor
true MySQL Extension mysql_extension

MySQL Extension

The mysql extension for PHP is incredibly old and has been superseded by two other extensions:

Not only did development stop long ago on mysql, but it has been officially removed in PHP 7.0.

To save digging into your php.ini settings to see which module you are using, one option is to search for mysql_* in your editor of choice. If any functions such as mysql_connect() and mysql_query() show up, then mysql is in use.

Even if you are not using PHP 7.x or later yet, failing to consider this upgrade as soon as possible will lead to greater hardship when the PHP upgrade does come about. The best option is to replace mysql usage with mysqli or PDO in your applications within your own development schedules so you won't be rushed later on.

If you are upgrading from mysql to mysqli, beware lazy upgrade guides that suggest you can simply find and replace mysql_* with mysqli_*. Not only is that a gross oversimplification, it misses out on the advantages that mysqli provides, such as parameter binding, which is also offered in PDO.