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

爱⌒轻易说出口 提交于 2019-12-02 06:25:09

问题


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. Yea I know, but it says it's installed when I do "php -m". It's in my php.ini file in php5-fpm as "extension=mysqli.so".

I find this guide http://www.php.net/manual/en/mysqli.installation.php quite hard to follow. Where is the ./configure file supposed to be? Is that for php5-mysql or does it hold true for percona mysql also?


回答1:


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:

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

For more on this, see http://php.net/manual/en/language.namespaces.fallback.php which says:

Class names always resolve to the current namespace name.



来源:https://stackoverflow.com/questions/26434305/mysqli-class-not-found-using-percona-php5-fpm-nginx-phalcon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!