简体   繁体   中英

PDO drivers no value in Windows

The php_pdo_mysql.dll can't be enabled in machine. 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.

What's wrong?

I had this same problem when I upgraded to 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.

I fixed it by changing the extension_dir to an absolute path . I'm guessing it got confused when running through Apache and made it relative to something else.

; 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"

; 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.

On an Windows Server 2012, Apache 2.4, php 5.4 installation, after trying everything else changing this worked...

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. On Windows machines it is common for multiple instances of php.ini to be created and cause confusion.

Also, calling php from the command line will give you an error message with more details as to why it may not be loading. It might be that the extension that you are trying to include is not compatible with your PHP installation. 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.

In PHP 7.1 x64 on windows with apache 2.4 x64:

extension_dir = "ext" doesn't work for me,

absolute path: extension_dir = "C:\DEV\PHP71\ext\" worked well

After change the php.ini configuration, need to restart Appche server in windows service. Then the extension module will be loaded. use following code to test: <?php print_r(get_loaded_extensions());?>

I was having this problem on Windows using IIS. My php.ini contained the following sections:

[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. I guess declaration order is important!

Mihai's comment in 2012 says: "Try php -m in console, it will show startup errors of 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.

Go to the Command Prompt and type php -m at the prompt. 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.

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.

I had the same issue, and was stumped until I read the following:

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

I am running PHP 5.2 with Apache 2.2. The fix for me was to copy the libmysql.dll file into my Apache bin directory.

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. 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. 4) Follow in instructions in the link above.

If you're using PHP Manager with IIS, do the following:

  1. Open IIS (I usually open it by typing IIS in start);启动 IIS

  2. Double-click "PHP Manager";点击 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";滚动到驱动程序并启用

  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. Check the list of dll extension entries.

extension=php_pdo_mysql.dll

entries must be placed next to all pdo entries. Same as

extension=php_mysql.dll

entries must be placed next to all without pdo entries.

Hops it helps..

I had this problem too. I have Apache/2.2.22 (Win32) PHP/5.3.23 on a Windows 7 machine. 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". It just needed adding the quotation marks.

I also added the php directory to the 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

PHP error PDO not exist on 5.4

Fatal error: Class 'DigitalToolBox\PDO' not found in C:\SERVER\www\MyAPP\DigitalToolBox\MysqlConnectionTool.php on line 19

you can see pdo is loaded because is in list with this comand:

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++;

I found my problem after lots of searching. In php.ini the extension directory was wrong. Check the slash direction. It should be backslashes as in following line. extension_dir = "C:\wamp\bin\php\php8.0.10\ext"

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

In wampserver also check phpForApache.ini for the same problem.

1.In php.ini, remove " around directory in etxnesion dir variable. It may looks like that:

extension_dir = c:\PHP\ext

  1. Copy The edited ini file (php.ini) to C:\windows dir

Then retstart 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

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).

All works for me now, though I'm not completely comfortable with moving things around the php directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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