MySQLConverterTool

MySQLConverterTool : How to Convert MySQL to MySQLi

MySQLConverterTool-master.zip

Introduction

The old MySQL extension (ext/mysql) was deprecated in PHP 5.5 and removed in PHP 7.0.

This tool converts ext/mysql code to ext/mysqli code, as ext/mysqli is the current MySQL extension. There's also PDO_MySQL but this tool does not use that. This tool is not perfect but will help with the conversion.

Alternatively, a quicker and simpler short-term fix is to use a bundled native PHP library such as php7-mysql-shim. Instead of converting code (e.g., mysql_connect() to mysqli_connect()) it uses ext/mysqli to define ext/mysqlfunctions in PHP. Much easier but more of a short-term fix. Although php7-mysql-shim contains PHP 7 in the name, it works with older PHP versions but only if ext/mysql is not installed on your system.

Usage

There are two interfaces: GUI and CLI. Example usages:

Using PHP's built-in web server

For example, in a terminal you might do this:

shell> wget https://github.com/philip/MySQLConverterTool/archive/master.zip
shell> unzip master.zip
shell> cd MySQLConverterTool-master/GUI
shell> php -S localhost:8000

Then, go to http://localhost:8000. From there you can choose to convert a snippet (copy-n-paste), a single file, or a directory. You can choose to convert the files themselves (assuming the web server has rights), make backups, or simply output the code to your browser.

Use CLI

Download as you did above, and here is an example to convert a file named /tmp/my.php

$ cd MySQLConverterTool-master
$ php cli.php -f /tmp/my.php

Execute php cli.php -h to see the available options.

Important Warning

That absolutely NO security checks are performed by the tool which prevent users from trying to read and convert files (e.g. /etc/passwd). Make sure to add security measures, if needed.

Additional Documentation

See the wiki for additional information, including screenshots.

Limitations

With short-open-tag disabled, short tags (<? and <?=) are essentially ignored due to how the tokenizer extension works. So, if you use the likes of <? (instead of <?php) then enable short-open-tag before executing the conversion otherwise that PHP code will be ignored (not converted). For details, see issue #16.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

Also, a mysql_result equivelant does not exist in ext/mysqli so you must define mysqli_result. The tool does suggest code for this but it does not insert this definition into your converted markup.

Alternatives

The php7-mysql-shim PHP library defines all mysql_ functions for you, so simply include it (a single PHP file) and your code should work without a need to convert. It uses ext/mysqli and works fine in PHP 5.3 or greater. There are pros and cons to each approach.

Also, consider refactoring your code. Whether you convert your code with MySQLConverterTool or define ext/mysql functions using a library such as php7-mysql-shim, these are considered stop-gap measures until you rewrite your code. For example, your new code will probably use prepared statements.

Other

Although unit tests exist, they were not maintained by the lazy developer here. Perhaps one day, see UnitTests/README.

All forms of feedback is welcome and encouraged! Either as bug reports, feature requests, pull requests, complaints, and so on.

 

[출처] https://github.com/philip/MySQLConverterTool

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
98 PHP 리다이렉션(페이지 이동)의 3가지 방법 졸리운_곰 2019.01.11 154
97 mysql_ 함수에서 mysqli_ 함수로 변환 : How to Convert MySQL to MySQLi file 졸리운_곰 2019.01.05 109
96 PHP 의존성 관리도구 – Composer 시작하기 졸리운_곰 2018.12.28 91
95 PHP Mysqli 함수(사용빈도 높은것만..^^) 졸리운_곰 2018.12.25 144
94 Java 개발자로서 PHP 최단 시간에 공부하기 졸리운_곰 2018.11.21 115
93 Learn Blockchain In PHP 졸리운_곰 2018.11.18 122
» MySQLConverterTool : How to Convert MySQL to MySQLi file 졸리운_곰 2018.11.16 89
91 How to Convert MySQL to MySQLi file 졸리운_곰 2018.11.16 100
90 php game programming ebook 2004 : php 게임 프로그래밍 file 졸리운_곰 2018.10.15 89
89 PHP Composer 설치 및 사용법 졸리운_곰 2018.09.27 403
88 [PHP] PhpStorm IDE 사용하기 file 졸리운_곰 2018.07.19 167
87 phpStorm 원격 서버 연결 및 배포 (Deployment) file 졸리운_곰 2018.07.18 193
86 php 세션 저장소를 redis 로 바꾸어 본 후기. file 졸리운_곰 2018.05.05 473
85 아이오닉과 php 그리고 mysql 연동 : Using PHP and MySQL with Ionic file 졸리운_곰 2018.01.14 373
84 CKEditor 4 설치와 PHP 연동 하기 file 졸리운_곰 2018.01.14 277
83 5가지 조미료같은 워드프레스 플러그인 file 졸리운_곰 2018.01.14 86
82 wordpress 한시간만에 만들기 졸리운_곰 2017.10.26 101
81 PHP 프레임 새로고침할 때 페이지 유지하기 입니다. 졸리운_곰 2017.09.17 413
80 How to install composer on Wamp file 졸리운_곰 2017.09.10 150
79 Install Composer on Windows and WAMP Server file 졸리운_곰 2017.09.10 89
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED