php 在 ubuntu 12.04 上同时安装 mysql 和 mysqlnd

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23158943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:32:41  来源:igfitidea点击:

install both mysql and mysqlnd on ubuntu 12.04

phpmysqlubuntu

提问by Siddharth Srivastva

I am having server at digital ocean and trying to run a custom php application. On my development machine: Mac OSX 10.7.5 PHP: 5.3.6 with mysql, mysqli, mysqlnd, pdo mysql

我在数字海洋拥有服务器并尝试运行自定义 php 应用程序。在我的开发机器上:Mac OSX 10.7.5 PHP: 5.3.6 with mysql, mysqli, mysqlnd, pdo mysql

But on the server: Ubuntu 12.04 PHP: 5.3.10

但是在服务器上:Ubuntu 12.04 PHP:5.3.10

with mysql, mysqli and pdo mysql

使用 mysql、mysqli 和 pdo mysql

I require mysqlnd to run my app. If i try

我需要 mysqlnd 来运行我的应用程序。如果我尝试

apt-get install php5-mysqlnd

it is giving error:

它给出了错误:

The following packages will be REMOVED:
php5-mysql
The following NEW packages will be installed:
php5-mysqlnd

If I install it, my app code breaks as it uses many mysqli commands.

如果我安装它,我的应用程序代码会中断,因为它使用了许多 mysqli 命令。

I searched and followed many stackoverflow question on same topic but all in vain. Though, I haven't tried configuration option

我搜索并关注了许多关于同一主题的 stackoverflow 问题,但都是徒劳的。虽然,我还没有尝试过配置选项

./configure --with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \

I dont know how to proceed with this and I could not find and tutorials or article on this.

我不知道如何进行此操作,也找不到关于此的教程或文章。

How My development machine has both but server couldn't.

我的开发机器如何同时拥有但服务器不能。

Please guide.

请指导。

回答by Nathan Friend

You probably need to enable the mysqlndextension. I ran into this problem recently (all references mysqliwere broken after installing php5-mysqlnd), and fixed it by adding the following line to the bottom of my php.ini:

您可能需要启用mysqlnd扩展。我最近遇到了这个问题(mysqli安装后所有引用都被破坏了php5-mysqlnd),并通过在我的 php.ini 底部添加以下行来修复它:

extension=mysqlnd.so

You can find the location of your php.ini in the output of phpinfo().

您可以在phpinfo()的输出中找到 php.ini 的位置。

Also note you'll need to restart your webserver for these changes to take effect.

另请注意,您需要重新启动网络服务器才能使这些更改生效。

回答by turbofan

I believe the "current" way of doing this is to enable that PHP module after you install it, much the way you do with an Apache module: sudo php5enmod mysqlnd

我相信这样做的“当前”方法是在安装后启用该 PHP 模块,就像使用 Apache 模块一样: sudo php5enmod mysqlnd

And then restart Apache for that module to load: sudo service apache2 restart

然后重新启动 Apache 以加载该模块: sudo service apache2 restart

That will create a symlink on /etc/php5/apache2/conf.d/from /etc/php5/mods-available/that Apache will pick up and load with priorities, like services during start-up. In my experience on Ubuntu 14 LTS it creates a symlink called 10-mysqlnd.inifrom mysqlnd.ini.

这将创建一个符号链接/etc/php5/apache2/conf.d//etc/php5/mods-available/Apache会在启动时拿起和负载优先级般的服务。根据我在 Ubuntu 14 LTS 上的经验,它从mysqlnd.ini创建了一个名为10-mysqlnd.ini的符号链接。

Here is a link for a more detailed explanationon the subject.

这是有关该主题的更详细说明的链接。