Posted on 2 Comments

ext/mysql compatibility script for PHP5

There’s a ext/mysql compatibility script for PHP5, written by John Coggeshall. I think this is useful, as you will want to move towards using ext/mysqli in PHP5 (new features, prepared statements, object oriented API as well as procedural, and much more) but may still have some legacy apps that need the old extension.

Of course you can still use ext/mysql in PHP5 next to ext/mysqli, but apparently some people had some issues with that. So the solution for that case is this simple PHP script called mysql2mysqli.php

You could put auto_prepend_file = /path/mysql2mysqli.php in your php.ini file. The script checks whether the mysqli extension is loaded, and the mysql extension not loaded. Then it activates itself. Easy!

Posted on 2 Comments

2 thoughts on “ext/mysql compatibility script for PHP5

  1. that’s weird, but I got zero problems enabling mysqli & mysql in the same time.

    ./sapi/cli/php -m | grep mysql
    mysql
    mysqli

    or did you mean Winblows users? (how bothers about them?)

  2. My setup is right now WinXP + Apache + php5.1 B3 (with both extensions) + MySQL 5.0.10

    I DL’ed the php package for Windows without installer. It seemed to me that the installer verson was mostly directed at IIS users, since teh installer version won’t configure for Apache during install anyway.

    I also have absolutely no problems running php_mysql and php_mysqli at the same time. What I did was simply having them both activated from php.ini and copying the php_mysql.dll php_mysqli.dll to the Apache\bin directory.

Comments are closed.