简体   繁体   English

未找到 Mysqli 类。 使用 percona、php5-fpm、nginx、phalcon

[英]Mysqli class not found. Using percona, php5-fpm, nginx, phalcon

Fatal error: Class 'TKStdlib\mysqli' not found in /var/www/tk-browser-app/application/library/tk-stdlib/DbAbstract.php on line 28

It sounds like I need mysqli installed.听起来我需要安装mysqli。 Yea I know, but it says it's installed when I do "php -m".是的,我知道,但它说它是在我执行“php -m”时安装的。 It's in my php.ini file in php5-fpm as "extension=mysqli.so".它在 php5-fpm 的 php.ini 文件中作为“extension=mysqli.so”。

I find this guide http://www.php.net/manual/en/mysqli.installation.php quite hard to follow.我发现这个指南http://www.php.net/manual/en/mysqli.installation.php很难遵循。 Where is the ./configure file supposed to be? ./configure 文件应该在哪里? Is that for php5-mysql or does it hold true for percona mysql also?那是用于 php5-mysql 还是也适用于 percona mysql?

You've set your script into a namespace and it's looking for the class in that namespace.您已将脚本设置为命名空间,并且它正在该命名空间中查找类。

You can work around this by explicitly trying to reference the mysqli class as a global class:您可以通过显式尝试将 mysqli 类引用为全局类来解决此问题:

$db = new \mysqli( ... );

For more on this, see http://php.net/manual/en/language.namespaces.fallback.php which says:有关更多信息,请参阅http://php.net/manual/en/language.namespaces.fallback.php ,其中说:

Class names always resolve to the current namespace name.类名总是解析为当前的命名空间名称。

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

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