在我的网络内php副本中启用mysqli [英] Enable mysqli in my in-webserver copy of php

查看:43
本文介绍了在我的网络内php副本中启用mysqli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如此处所讨论的: 当直接运行而不是通过js运行时,mysqli可以工作-ajax

As is discussed here: mysqli works when run directly but not when via js-ajax

我可能需要在我的Web服务器php副本中启用mysqli. 已经在命令行中启用了它.

I may need to enable mysqli in my webserver php copy. It is enabled in the command line already.

我如何确定在特定的php副本中是否启用了mysqli, 如果不是,该如何安装?

How do I figure out if mysqli is enabled in a specific php copy, and if it's not, how do I install it?

我的网络服务器正在运行Ubuntu 14.04.2 LTS.

My webserver is running Ubuntu 14.04.2 LTS.

我现在尝试在php.ini文件中具有以下扩展名:

I have now tried having the following extensions in my php.ini file:

extension=mysqli.so
extension=pdo_mysql.so
extension=php_mysqli.so

我尝试分别运行它们,重新启动mysql和apache,运行sudo php5enmod mysqli,然后再次运行页面,但相同的错误不断在/var/log/apache/error.log中弹出:

I have tried running them all separately, restarted mysql and apache, ran sudo php5enmod mysqli and then I run the page again, but the same error keeps popping up in /var/log/apache/error.log:

PHP Fatal error:  Class 'mysqli' not found in /var/www/html/..

除非我从服务器端运行insert.php,否则什么都不会添加到sql表中.

And nothing gets added to the sql table unless I run the insert.php from the server side.

当我在php.ini文件中拥有所有三个扩展名时,我会得到以下错误:

When I have all three extension in the php.ini file I get the following errors are well:

Failed loading /usr/lib64/php/modules/ioncube_loader_lin.so:  /usr/lib64/php/modules/ioncube_loader_lin.so: cannot open shared object file: No such file or directory
Failed loading /usr/lib64/php/modules/ixed.lin:  /usr/lib64/php/modules/ixed.lin: cannot open shared object file: No such file or directory
Failed loading /usr/lib64/php/modules/ZendOptimizer.so:  /usr/lib64/php/modules/ZendOptimizer.so: cannot open shared object file: No such file or directory
Failed loading /usr/lib64/php/modules/opcache.so:  /usr/lib64/php/modules/opcache.so: cannot open shared object file: No such file or directory

推荐答案

从您的评论看来,您的extension_dir设置为/usr/lib64/php/modules,但是该文件夹在您的系统上不存在.

From your comments it appears your extension_dir was set to /usr/lib64/php/modules but this folder did not exist on your system.

在您的系统上,mysqli.so模块实际上是在/usr/lib/php5/20121212/mysqli.so

On your system the mysqli.so module was actually found in /usr/lib/php5/20121212/mysqli.so

要解决此问题,可以将extension_dir设置为/usr/lib/php5/20121212,以便extension=mysqli.so行能够找到共享对象.

To resolve the issue, you can set the extension_dir to /usr/lib/php5/20121212 so that the extension=mysqli.so line is able to find the shared object.

这篇关于在我的网络内php副本中启用mysqli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆