Home >Backend Development >PHP Tutorial >解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:

解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:

WBOY
WBOYOriginal
2016-08-08 09:32:201999browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn