解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:(
Posted lewo的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:(相关的知识,希望对你有一定的参考价值。
解决方法1:
禁止php报错
display_errors = On |
改为 |
display_errors = Off |
鉴于这个服务器都是给用户用的,有时候他们需要报错(…都是给朋友用的,^_^),不能这做,让他们改程序吧,看方案2.
解决方法2:
常用的php语法连接mysql如下
<?php |
$link = mysql_connect( ‘localhost‘ , ‘user‘ , ‘password‘ ); |
mysql_select_db( ‘dbname‘ , $link ); |
改成mysqi |
<?php |
$link = mysqli_connect( ‘localhost‘ , ‘user‘ , ‘password‘ , ‘dbname‘ ); |
常用mysql建表SQL如下
<?php |
// 老的 |
mysql_query( ‘CREATE TEMPORARY TABLE `table`‘ , $link ); |
// 新的 |
mysqli_query( $link , ‘CREATE TEMPORARY TABLE `table`‘ ); |
解决方法三:
在php程序代码里面设置报警级别
<?php |
error_reporting (E_ALL ^ E_DEPRECATED); |
Deprecated的问题就这样解决掉了,不过还是建议大家尽快取消mysql的用户,全部都走向mysqli或者mysqlnd等等。mysql确实是太不安全而且太老旧了。
转载请注明出处:http://www.ttlsa.com/html/2502.html
版权说明
文章标题: 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in本文地址: http://www.ttlsa.com/php/deprecated-mysql-connect/
除非注明,博客文章均为"运维生存时间"原创,转载请标明本文地址
以上是关于解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:(的主要内容,如果未能解决你的问题,请参考以下文章
Ecshop如何解决Deprecated: preg_replace()报错
错误:找不到成员:'packageRoot',如何解决忽略:Flutter 中的 deprecated_member_use?
MYSQL版本问题:解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in th
解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future:(
php 版本升高后 会出现 之Deprecated: Function ereg_replace() is deprecated的解决方法