Home >Backend Development >PHP Tutorial >解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:
php has 5 versions, 5.2, 5.3, 5.4, 5.5. I am afraid that I cannot keep up with the times. The new server directly uses 5.5, but the program has the following error: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in the future. The meaning is very clear. It says that the mysql_connect module will be deprecated in the future. Please use mysqli or PDO instead. mysqli More rigorous, safe and efficient
Solution 1:
Disable php error reporting
display_errors = On
Change to
display_errors = Off
Since this server is for users, sometimes they need to report errors (…all It’s for friends, ^_^), you can’t do this, let them change the program, see solution 2.
Solution 2:
error_reporting(E_ALL ^ E_DEPRECATED);
The above introduces the solution to Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.