dkplus / mysql-migration-layer
Layer for migration from mysql to mysqli.
Requires
- php: >=5.3
- ext-mysqli: *
Requires (Dev)
- ext-mysql: *
- phpunit/dbunit: >=1.2
- phpunit/phpunit: ~3.7
- satooshi/php-coveralls: ~0.6
- squizlabs/php_codesniffer: 1.4.*
Suggests
- nikic/php-parser: If you want to use automatic converting
This package is auto-updated.
Last update: 2024-12-08 23:12:36 UTC
README
Layer for migration from mysql to mysqli.
Installation
composer
For composer documentation, please refer to getcomposer.org.
php composer.phar require dkplus/mysql-migration-layer
Post-install
After installing replace all mysql_*()
calls with \MySQL\Proxy::*()
.
You can do this step automatically. Therefore you must also install nikic/php-parser:
php composer.phar require nikic/php-parser:1.*
Then you can run the converter by calling:
php vendor/bin/convert-mysql.php [-w] <file>
Run the script with the path of the PHP file you wish to convert as argument. This will print the converted source code to STDOUT.
You can add the -w
switch if you want to override the original file with the converted code.
In case of any error, an error message is written to STDERR and the script exits with a return code of 1.
Use find to convert a whole directory recursively:
find <directory> -name "*.php" -exec php "vendor/bin/convert-mysql.php" -w "{}" \;