PHPCompatibility Code
PHPCompatibility.Extensions.RemovedExtensions.mysql_DeprecatedRemoved
Recommendation
Use the mysqli extension:
- If the application uses an ORM, offers a
mysqli
adapter, you did not override anything in themysql
adapter, and you do not use anymysql_
functions outside the ORM. then you can simply switch the ORM's adapter. - Otherwise, create a compatibility class, such as
MysqlToMysqli
, to replicatemysql
behavior inmysqli
.
You could also switch to PDO, but that would require more effort because the differences are more pronounced.
Common Changes
One of the most obvious changes is that mysql_
functions magically used the last database connection, whereas mysqli_
functions need the connection object to be explicit.
Functions
- mysql_connect and mysql_close
- More coming soon.
Migration Services
Increase security and cut risk by simplifying PHP application upgrades and migrations.
Get Long-Term Support With ZendPHP
Stay secure and compliant while migrating on your schedule with Zend PHP LTS.