简体   繁体   English

未捕获的错误:Class 'mysqli' 在 Windows 10 上找不到 Apache 2.4,Z2FECZ32304A5C2BBAC10

[英]Uncaught Error: Class 'mysqli' not found on Windows 10 with Apache 2.4, PHP 7.4

System/Software:系统软件:

  • Windows 10 Pro 64 bit, Version 1909 Windows 10 Pro 64 位,版本 1909
  • httpd-2.4.43-win64-VS16 httpd-2.4.43-win64-VS16
  • php-7.4.5-Win32-vc15-x64 php-7.4.5-Win32-vc15-x64
  • mysql-installer-web-community-8.0.20.0 mysql-installer-web-community-8.0.20.0

PHP Script PHP 脚本

if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
    echo 'We don\'t have mysqli!!!';
} else {
    echo 'Phew we have it!';
}

Yields: We don't have mysqli!!!产量: We don't have mysqli!!!

phpinfo phpinfo

在此处输入图像描述

php.ini directives php.ini 指令

extension_dir = "ext"
extension=mysqli

Looking at the phpinfo , it seems like mysqlnd is loaded, but mysqli is not.查看phpinfo ,似乎mysqlnd已加载,但mysqli未加载。 I don't know how to get it loaded.我不知道如何加载它。

Question问题

How do I load mysqli module on Windows, when it seems like I already have directives in php.ini to have it be loaded?我如何在 Windows 上加载mysqli模块,似乎我已经在php.ini中有指令来加载它?

Update - I found these更新 - 我找到了这些

  • phpinfo() reports: Configuration File (php.ini) Path: C:\Windows phpinfo()报告:配置文件 (php.ini) 路径: C:\Windows
  • phpinfo() reports: Loaded Configuration File: (none) phpinfo()报告:加载的配置文件:( (none)
  • My php.ini file is located in C:\php\php.ini我的php.ini文件位于C:\php\php.ini

When setting up previous versions of PHP Configuration File Path used to be C:\php\php.ini .在设置以前版本的 PHP 时,配置文件路径曾经是C:\php\php.ini Move to C:\Windows seems to be new, and that is what threw me off.移动到C:\Windows似乎是新的,这就是让我失望的原因。 If someone can find a proper official docs or guide where this is explained or documented, I will appreciate it.如果有人可以找到适当的官方文档或指南来解释或记录这一点,我将不胜感激。 I was not able to successfully find proper installation instructions for PHP just yet, and was going by memory of my previous experiences.我还没有成功找到 PHP 的正确安装说明,并且我之前的经验是 memory。

My Configuration File (php.ini) Path was blank, and for whatever reason, PHP was looking for php.ini file in C:\Windows , and not in C:\php , where I usually had it in the past. My Configuration File (php.ini) Path was blank, and for whatever reason, PHP was looking for php.ini file in C:\Windows , and not in C:\php , where I usually had it in the past. I moved my php.ini file into C:\Windows , and it seems like we are happy again.我将我的php.ini文件移动到C:\Windows中,看起来我们又开心了。

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

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