Jump to content

Whats the big deal on converting to MySQLi?


laflair13

Recommended Posts

This is for my own knowledge. I was looking into switching my site from mysql to mysqli because other say it is being depreciated with php 7. Well my question is, why is there such a sudden urge for it?

 

I am on hostgator and they dont see in the near future when they (if they do) switch to the new php 7. They are still on php 5.5

 

Just curious on why everyone keeps saying that we all should switch to MySQLi or PDO like right now.

 

Would like other thoughts and opinons on this.

 

Thanks

Link to comment
Share on other sites

it is being depreciated with php 7

That's not quite right. The old mysql extension is already deprecated (as of 5.5.0). In the next major version of PHP it is likely to be removed entirely meaning you (or your host) would have to specifically enable it rather than it being "standard".

 

The newer API's such as Mysqli or PDO are being actively maintained and also provide more advanced/useful features such as prepared statements, bound parameters, transactions, etc. The mysql extension on the other hand currently would receive only major security fixes, and probably soon not even that. There is a page in the manual describing the different APIs that you should read if you want to know more.

 

It's in your best interest to convert to the newer API's now while you have time to plan, implement, and test the changes. Eventually you'll get an email from your host along the lines of "We are upgrading PHP next week. The Mysql extension is no longer and any scripts relying on it will no longer function." If you haven't already upgraded your stuff by the time that email comes then you'll suddenly be in rush mode to either 1) Update your stuff like you should have already done or 2) Move to another host that will still support the extension.

 

All that said, even a new release of PHP were out tomorrow that excluded the extension, you're probably at least 3 years away from a host dropping support. Most hosts will continue to support it for a while because not doing so would be bad for business. Hosts already support multiple versions of PHP so keeping 5.5/5.6 around for mysql support wouldn't be a big deal.

 

Essentially the threat of the mysql extension going away is not why you should be updating. You should be updating because the extension is old, effectively abandoned, and lacks support for what are considered critical features for modern applications.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.