简体   繁体   English

PDO 驱动程序在 Windows 中没有价值

[英]PDO drivers no value in Windows

The php_pdo_mysql.dll can't be enabled in machine. php_pdo_mysql.dll无法在机器中启用。 I have set extension=php_pdo.dll and extension=php_pdo_mysql.dll enabled in php.ini, but when I checked phpinfo() , the item PDO drivers is no value . I have set extension=php_pdo.dll and extension=php_pdo_mysql.dll enabled in php.ini, but when I checked phpinfo() , the item PDO drivers is no value .

and also I can't find the mysql infos in phpinfo() but I have set extension=php_mysql.dll enabled.而且我在 phpinfo() 中找不到 mysql 信息,但我设置了extension=php_mysql.dll启用。

What's wrong?怎么了?

I had this same problem when I upgraded to PHP 5.4.当我升级到 PHP 5.4 时,我遇到了同样的问题。 I had我有

extension_dir = "ext"

in php.ini and php -m was starting fine and reporting that it loaded pdo_mysql, but when I ran phpinfo.php through apache, the driver was missing. in php.ini and php -m was starting fine and reporting that it loaded pdo_mysql, but when I ran phpinfo.php through apache, the driver was missing.

I fixed it by changing the extension_dir to an absolute path .我通过将extension_dir更改为绝对路径来修复它。 I'm guessing it got confused when running through Apache and made it relative to something else.我猜它在运行 Apache 并使其相对于其他东西时感到困惑。

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "D:/php-5.4.11-Win32-VC9-x86/ext"

try the following: look for this in your php.ini and uncomment extension_dir = "ext"请尝试以下操作:在您的 php.ini 中查找此内容并取消注释extension_dir = "ext"

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
 extension_dir = "ext"

Try php -m in console, it will show startup errors of PHP.在控制台尝试php -m ,它会显示 PHP 的启动错误。

On an Windows Server 2012, Apache 2.4, php 5.4 installation, after trying everything else changing this worked...在 Windows Server 2012、Apache 2.4、php 5.4 安装上,在尝试了其他一切改变它的工作后...

PHPIniDir "C:\php\"

to

PHPIniDir "C:/php/"

...guh. ……嗯。

Check with phpinfo() to ensure that the path for the php.ini is the same one being set.检查 phpinfo() 以确保 php.ini 的路径与设置的路径相同。 On Windows machines it is common for multiple instances of php.ini to be created and cause confusion.在 Windows 机器上,通常会创建 php.ini 的多个实例并导致混淆。

Also, calling php from the command line will give you an error message with more details as to why it may not be loading.此外,从命令行调用 php 会给您一条错误消息,其中包含有关它可能无法加载的更多详细信息。 It might be that the extension that you are trying to include is not compatible with your PHP installation.您尝试包含的扩展可能与您的 PHP 安装不兼容。 ie it is a non thread safe dll with a thread safe binary or there is a compiler mismatch somewhere where vc9 and vc6 were both used.即它是具有线程安全二进制文件的非线程安全 dll 或者在同时使用 vc9 和 vc6 的地方存在编译器不匹配。

In PHP 7.1 x64 on windows with apache 2.4 x64:在 PHP 7.1 x64 上 windows 和 apache 2.4 x64:

extension_dir = "ext" doesn't work for me, extension_dir = "ext" 对我不起作用,

absolute path: extension_dir = "C:\DEV\PHP71\ext\" worked well绝对路径: extension_dir = "C:\DEV\PHP71\ext\" 效果很好

After change the php.ini configuration, need to restart Appche server in windows service.更改 php.ini 配置后,需要重启 windows 服务中的 Appche 服务器。 Then the extension module will be loaded.然后将加载扩展模块。 use following code to test: <?php print_r(get_loaded_extensions());?>使用以下代码进行测试: <?php print_r(get_loaded_extensions());?>

I was having this problem on Windows using IIS.我在使用 IIS 的 Windows 上遇到了这个问题。 My php.ini contained the following sections:我的 php.ini 包含以下部分:

[PHP_PDO_MYSQL]
extension=php_pdo_mysql.dll
[PHP_PDO]
extension=php_pdo.dll

I simply took the [PHP_PDO_MYSQL] and [PHP_PDO] sections, and swapped their positions, so that [PHP_PDO] came first.我只是简单地选择了[PHP_PDO_MYSQL][PHP_PDO]部分,并交换了它们的位置,因此[PHP_PDO]排在第一位。 I guess declaration order is important!我想申报顺序很重要!

Mihai's comment in 2012 says: "Try php -m in console, it will show startup errors of PHP." Mihai 在 2012 年的评论说:“在控制台中尝试 php -m,它将显示 PHP 的启动错误。” This suggestion proved to be most helpful.这个建议被证明是最有帮助的。 If there are any errors in the php.ini file, Windows PHP manager (IIS 8) is not very clear about what's wrong with php.ini. If there are any errors in the php.ini file, Windows PHP manager (IIS 8) is not very clear about what's wrong with php.ini.

Go to the Command Prompt and type php -m at the prompt. Go 到命令提示符并在提示符处键入php -m A pop-up message (alert) will let you know about any errors AND it gives line numbers for those problems.弹出消息(警报)会让您知道任何错误,并为这些问题提供行号。 In most cases, my only issue was that I had uncommented (removed the semi-colon) on a few php.ini lines where I should NOT have done so.在大多数情况下,我唯一的问题是我在一些不应该这样做的 php.ini 行上取消了注释(删除了分号)。

Another helpful tip for me was to put in the full path for the extensions folder, (see comment above by Jeremy Prine) which helped with the "missing dll" messages started popping up in the alert boxes.另一个对我有用的提示是输入扩展文件夹的完整路径(请参阅 Jeremy Prine 上面的评论),这有助于“缺少 dll”消息开始在警报框中弹出。

I had the same issue, and was stumped until I read the following:我遇到了同样的问题,直到我读到以下内容才被难住:

http://www.artfulsoftware.com/php_mysql_win.html http://www.artfulsoftware.com/php_mysql_win.html

I am running PHP 5.2 with Apache 2.2.我正在运行 PHP 5.2 和 Apache 2.2。 The fix for me was to copy the libmysql.dll file into my Apache bin directory.我的解决方法是将 libmysql.dll 文件复制到我的 Apache bin 目录中。

I would recommend the following course of action to anyone having this issue: 1) check to make sure that loaded configuration file is where you think it is (ie, that Apache is not using some default php.ini) - phpinfo() will provide the answer on this 2) check to make sure that all desired extensions are located in the php\ext folder and are included in the php.ini file (most popular extensions simply need to be uncommented) 3) Try to load pdo_sqllite.我会向遇到此问题的任何人推荐以下操作过程:1)检查以确保加载的配置文件在您认为的位置(即 Apache 未使用某些默认 php.ini) - phpinfo() 将提供2) 检查以确保所有需要的扩展都位于 php\ext 文件夹中,并包含在 php.ini 文件中(最流行的扩展只需取消注释) 3) 尝试加载 pdo_sqllite。 If this shows up in phpinfo() after restarting Apache, you've narrowed the problem to the inability of Apache to load the necessary mysql extensions.如果在重新启动 Apache 后这出现在 phpinfo() 中,则您已将问题缩小到 Apache 无法加载必要的 mysql 扩展。 4) Follow in instructions in the link above. 4)按照上面链接中的说明进行操作。

If you're using PHP Manager with IIS, do the following:如果您将PHP 管理器与 IIS 一起使用,请执行以下操作:

  1. Open IIS (I usually open it by typing IIS in start);打开 IIS (我通常通过在开始时输入 IIS 来打开它);启动 IIS

  2. Double-click "PHP Manager";双击“PHP 管理器”;点击 PHP 管理器

  3. Click "Enable or disable an extension";点击“启用或禁用扩展”;启用/禁用扩展

  4. Scroll down to find your driver of choice (in my case php_pdo_mysqll.dll ), and click "enable";向下滚动以找到您选择的驱动程序(在我的情况下php_pdo_mysqll.dll ),然后单击“启用”;滚动到驱动程序并启用

  5. After that the driver should show up, and work.之后,司机应该出现并工作。启用的驱动程序

  6. Done, Hopefully this helped someone.完成,希望这对某人有所帮助。 because the other answers did not work for me.因为其他答案对我不起作用。

PDO Drivers no value - your dll entries cannot orderized in php.ini file. PDO 驱动程序没有价值 - 您的 dll 条目无法在 php.ini 文件中排序。 Check the list of dll extension entries.检查 dll 扩展条目列表。

extension=php_pdo_mysql.dll

entries must be placed next to all pdo entries.条目必须放在所有 pdo 条目旁边。 Same as如同

extension=php_mysql.dll

entries must be placed next to all without pdo entries.条目必须放在所有没有 pdo 条目的旁边。

Hops it helps..啤酒花它有帮助..

I had this problem too.我也有这个问题。 I have Apache/2.2.22 (Win32) PHP/5.3.23 on a Windows 7 machine.我在 Windows 7 机器上有 Apache/2.2.22 (Win32) PHP/5.3.23。 My solution was changing extension_dir = C:\Program Files (x86)\PHP\ext in the php.ini file to extension_dir = "C:\Program Files (x86)\PHP\ext".我的解决方案是将 php.ini 文件中的 extension_dir = C:\Program Files (x86)\PHP\ext 更改为 extension_dir = "C:\Program Files (x86)\PHP\ext"。 It just needed adding the quotation marks.它只需要添加引号。

I also added the php directory to the CLASSPATH.我还将 php 目录添加到 CLASSPATH 中。

check that pdo*.dll files are in appropriate locations in OS directory, check references for these files are enabled in php.ini, check your dbconnection string is correct, restart apache检查 pdo*.dll 文件是否在 OS 目录中的适当位置,检查这些文件的引用是否在 php.ini 中启用,检查您的 dbconnection 字符串是否正确,重新启动 ZB6EFD606D118D0F62066E31419FF4

PHP error PDO not exist on 5.4 PHP 错误 PDO 在 5.4 上不存在

Fatal error: Class 'DigitalToolBox\PDO' not found in C:\SERVER\www\MyAPP\DigitalToolBox\MysqlConnectionTool.php on line 19致命错误:Class 'DigitalToolBox\PDO' not found in C:\SERVER\www\MyAPP\DigitalToolBox\MysqlConnectionTool.php 上线

you can see pdo is loaded because is in list with this comand:您可以看到 pdo 已加载,因为它在此命令的列表中:

print_r(get_loaded_extensions()); 

this error happens for the use of namespaces , we need to add at the beginning of our code the instruction:使用命名空间会发生此错误,我们需要在代码的开头添加指令:

use PDO;

IF ($this->works) $voteForThis++; IF ($this->works) $voteForThis++;

I found my problem after lots of searching.经过大量搜索,我发现了我的问题。 In php.ini the extension directory was wrong.在 php.ini 中,扩展目录错误。 Check the slash direction.检查斜线方向。 It should be backslashes as in following line.它应该是反斜杠,如下行所示。 extension_dir = "C:\wamp\bin\php\php8.0.10\ext" extension_dir = "C:\wamp\bin\php\php8.0.10\ext"

Incorrect: extension_dir = "C:/wamp/bin/php/php8.0.10/ext"不正确:extension_dir = "C:/wamp/bin/php/php8.0.10/ext"

In wampserver also check phpForApache.ini for the same problem.在 wampserver 中还检查 phpForApache.ini 是否存在相同的问题。

1.In php.ini, remove " around directory in etxnesion dir variable. It may looks like that: 1.在 php.ini 中,删除 etxnesion dir 变量中的“目录”。它可能看起来像这样:

extension_dir = c:\PHP\ext extension_dir = c:\PHP\ext

  1. Copy The edited ini file (php.ini) to C:\windows dir将编辑好的ini文件(php.ini)复制到C:\windows dir

Then retstart appache !然后重新启动appache!

Done!完毕!

I got hints here:我在这里得到了提示:

http://wiki.cementhorizon.com/display/CH/Solution+-+Unable+to+load+dynamic+library+C+php+ext+php_mysql.dll+-+the+specified+module+could+not+be+found http://wiki.cementhorizon.com/display/CH/Solution+-+Unable+to+load+dynamic+library+C+php+ext+php_mysql.dll+-+the+specified+module+could+not+be+成立

I made sure that I set c:/php as a PATH variable and then moved the appropriate dlls into the c:/php directory (from the c:/php/ext directory).我确保我将c:/php设置为 PATH 变量,然后将适当的 dll 移动到c:/php目录中(来自c:/php/ext目录)

All works for me now, though I'm not completely comfortable with moving things around the php directory.现在一切都对我有用,尽管我对在 php 目录中移动东西并不完全满意。

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

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