5

I have been noticing for a long time on Stack Overflow that most users recommend to use PDO instead of mysql_*, because PDO is more secure than mysql_*. But my question is if websites which are already running with mysql_* will stops working? Or what exactly does "deprecating" mean here? So should we have never used mysql_*? From which PHP version is is deprecated?

1
  • 2
    It should be. But the people behind Zend are very conservative.
    – Andrea
    Sep 12, 2012 at 14:27

2 Answers 2

8

See PHP.net page FAQ. It answers your question and gives migration advice.

Your code won't suddenly stop working unless when PHP remove the functionality, you upgrade your PHP version. The FAQ page advice recommends you write new code using one of the alternatives. If it's not a massive job, it could be worth considering switching.. that depends on your project though.

1

The websites written with mysql_* functions shall continue to work until PHP removes the functionality altogether. As of now, the functions are merely depreciated.

Deprecated means that those functions are no longer recommended, and are replaced with better functions. They may have no support either.

It's recommended to switch over to PDO mainly because of the security that it provides with injection based attacks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.