• 48501

    文章

  • 446

    评论

  • 37

    友链

  • 最近新加了换肤功能,大家多来逛逛吧~~~~
  • 喜欢这个网站的朋友可以加一下QQ群,我们一起交流技术。

Ubuntu16.04 PHP7.0 不能用MYSQLi方式连接MySQL5.7数据库

喜欢本站的朋友可以收藏本站,或者加入QQ群:172816590Web网页设计师,我们大家一起来交流技术!

欢迎来到梁钟霖个人博客网站。本个人博客网站提供最新的站长新闻,各种互联网资讯。 还提供个人博客模板,最新最全的java教程,java面试题。在此我将尽我最大所能将此个人博客网站做的最好! 谢谢大家,愿大家一起进步!

Q: Ubuntu16.04 PHP7.0 不能用MYSQLi方式连接MySQL5.7数据库

A: 执行以下2条命令解决:

apt-get install php-mysql

service apache2 restart
 

php -m    执行后会多以下4个模块:

mysqli

mysqlnd

PDO

pdo_mysql



✘ ⚡ root@NanoPi-NEO2  /var/www/html mysql --version
mysql  Ver 14.14 Distrib 5.7.22, for Linux (aarch64) using  EditLine wrapper
 ⚡ root@NanoPi-NEO2  /etc/php php -v
PHP 7.0.30-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.30-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
 ⚡ root@NanoPi-NEO2  /etc/php 


 ⚡ root@NanoPi-NEO2  /etc/php/7.0/apache2 apt-get install php-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  php7.0-mysql
The following NEW packages will be installed:
  php-mysql php7.0-mysql
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 104 kB of archives.
After this operation, 459 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main arm64 php7.0-mysql arm64 7.0.30-0ubuntu0.16.04.1 [102 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main arm64 php-mysql all 1:7.0+35ubuntu6.1 [1,928 B]
Fetched 104 kB in 2s (40.3 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package php7.0-mysql.
(Reading database ... 49593 files and directories currently installed.)
Preparing to unpack .../php7.0-mysql_7.0.30-0ubuntu0.16.04.1_arm64.deb ...
Unpacking php7.0-mysql (7.0.30-0ubuntu0.16.04.1) ...
Selecting previously unselected package php-mysql.
Preparing to unpack .../php-mysql_1%3a7.0+35ubuntu6.1_all.deb ...
Unpacking php-mysql (1:7.0+35ubuntu6.1) ...
Processing triggers for libapache2-mod-php7.0 (7.0.30-0ubuntu0.16.04.1) ...
Processing triggers for php7.0-fpm (7.0.30-0ubuntu0.16.04.1) ...
Setting up php7.0-mysql (7.0.30-0ubuntu0.16.04.1) ...

Creating config file /etc/php/7.0/mods-available/mysqlnd.ini with new version

Creating config file /etc/php/7.0/mods-available/mysqli.ini with new version

Creating config file /etc/php/7.0/mods-available/pdo_mysql.ini with new version
Setting up php-mysql (1:7.0+35ubuntu6.1) ...
Processing triggers for libapache2-mod-php7.0 (7.0.30-0ubuntu0.16.04.1) ...
Processing triggers for php7.0-fpm (7.0.30-0ubuntu0.16.04.1) ...
 ⚡ root@NanoPi-NEO2  /etc/php/7.0/apache2 
 ⚡ root@NanoPi-NEO2  /etc/php/7.0/apache2 service apache2 restart
 ⚡ root@NanoPi-NEO2  /etc/php/7.0/apache2 


⚡ root@NanoPi-NEO2  /etc/php/7.0/apache2 php -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache


 转载至链接:https://my.oschina.net/SamXIAO/blog/1835376



转载原创文章请注明出处,转载至: 梁钟霖个人博客www.liangzl.com

您觉喜欢本网站,或者觉得本文章对您有帮助,那么可以选择打赏。
打赏多少,您高兴就行,谢谢您对梁钟霖这小子的支持! ~(@^_^@)~

  • 微信扫一扫

  • 支付宝扫一扫

    支付宝打赏

2条评论

Loading...
  • 升进468L

    Ubuntu16.04 执行apt-get install php-mysql出现的问题,该怎么解决 下列软件包有未满足的依赖关系: php-mysql : 依赖: php7.0-mysql 但是它将不会被安装 E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

  • jack341L

    果然是没有安装php-mysql



发表评论

电子邮件地址不会被公开。 必填项已用*标注

自定义皮肤
注册梁钟霖个人博客