简体   繁体   English

mysqlnd驱动程序只有一个api扩展(pdo_mysql)

[英]mysqlnd driver has only one api extension (pdo_mysql)

After checking phpinfo() I saw that mysqlnd driver installed on linux (php 5.4) has only one API extension ( pdo_mysql ), but I also want to be able to work with mysqli . 检查phpinfo()之后,我看到在Linux(php 5.4)上安装的mysqlnd驱动程序只有一个API扩展( pdo_mysql ),但是我也希望能够使用mysqli

How do I associate mysqlnd driver with mysqli extension? 如何将mysqlnd驱动程序与mysqli扩展名关联?

I guess I can fix this by reinstalling mysql, but is there any workaround? 我想我可以通过重新安装mysql来解决此问题,但是有什么解决方法吗?

Please help! 请帮忙! Thank you! 谢谢!

Assuming that you did install mysql correctly. 假设您确实正确安装了mysql。

Locate your php.ini by executing phpinfo() or by typing the following command: 通过执行phpinfo()或键入以下命令来找到您的php.ini:

php --ini

look for something like "Loaded Configuration File:" and copy the full path of your loaded php configuration file (in my case it is located at: /usr/local/etc/php/5.6/php.ini). 查找类似于“已加载的配置文件:”的内容,然后复制已加载的php配置文件的完整路径(在我的情况下,该文件位于:/usr/local/etc/php/5.6/php.ini)。

Open php.ini in an editor, for an example: 例如,在编辑器中打开php.ini:

sudo nano /usr/local/etc/php/5.6/php.ini

Now please add (or make sure it's there) the following line in your php.ini: 现在,请在php.ini中添加(或确保它存在)以下行:

extension=mysqli.so

(The extension include line might already be there but commented out - uncomment it in that case) (扩展包含行可能已经存在但被注释掉了(在这种情况下,请取消注释)

Save your changes, and then restart apache and mysql: 保存更改,然后重新启动apache和mysql:

sudo /etc/init.d/apache2 restart
sudo /etc/init.d/mysql restart

After that all should work fine. 之后,一切都应该正常工作。

If you are interested in installing mysql (in case it was not installed correctly for an example), please run the following command in your terminal screen: 如果您对安装mysql感兴趣(以防未正确安装mysql),请在终端屏幕上运行以下命令:

sudo apt-get install php5-mysql

Good luck! 祝好运!

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

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