php7和mysql扩展 [英] php7 and mysql extension
本文介绍了php7和mysql扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
启动以下代码后...
After launching the following code...
<?php
error_reporting(E_ALL);
mysql_connect()
?>
我的日志中是Uncaught Error: Call to undefined function mysql_connect()
.
首先想到的是做sudo apt-get install php-mysql
但它会输出
The first thing that comes in mind is to do sudo apt-get install php-mysql
but it outputs
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-mysql is already the newest version
之后,我做了dpkg --list | grep mysql
,并说php-mysql
和php7.0-mysql
已安装.
after that I did dpkg --list | grep mysql
and it said that php-mysql
and php7.0-mysql
are installed.
这是怎么了?
PS. PHP版本为7.0.8
.
推荐答案
调用未定义函数mysql_connect
Call to undefined function mysql_connect
mysql_
库在多年前已弃用.在PHP 7中已将其完全删除.
The mysql_
library was deprecated years ago. It has been removed entirely in PHP 7.
使用现代替代品,例如PDO或mysqli_
.
Use a modern replacement such as PDO or mysqli_
.
这篇关于php7和mysql扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文