简体   繁体   English

在ubuntu 12.04上安装mysql和mysqlnd

[英]install both mysql and mysqlnd on ubuntu 12.04

I am having server at digital ocean and trying to run a custom php application. 我在数字海洋有服务器,并试图运行自定义的PHP应用程序。 On my development machine: Mac OSX 10.7.5 PHP: 5.3.6 with mysql, mysqli, mysqlnd, pdo mysql 在我的开发机器上:Mac OSX 10.7.5 PHP:5.3.6与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. 我需要mysqlnd来运行我的应用程序。 If i try 如果我试试

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. 我搜索并跟踪了许多相同主题的stackoverflow问题,但都是徒劳的。 Though, I haven't tried configuration option 虽然,我没有尝试过配置选项

./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. 请指导。

You probably need to enable the mysqlnd extension. 您可能需要启用mysqlnd扩展。 I ran into this problem recently (all references mysqli were broken after installing php5-mysqlnd ), and fixed it by adding the following line to the bottom of my php.ini: 我最近遇到了这个问题(所有引用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. 另请注意,您需要重新启动网络服务器才能使这些更改生效。

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. 这将在/etc/php5/apache2/conf.d/上创建一个符号链接/etc/php5/mods-available/ ,Apache将启动并加载优先级,如启动期间的服务。 In my experience on Ubuntu 14 LTS it creates a symlink called 10-mysqlnd.ini from mysqlnd.ini . 根据我在Ubuntu 14 LTS上的经验,它从mysqlnd.ini创建了一个名为10-mysqlnd.ini的符号链接。

Here is a link for a more detailed explanation on the subject. 以下是有关该主题的更详细说明的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM