PHP PDO extension not working on IIS
I have a script which uses __autoload() to load classes (stupid, I know, this is old code I used to use for fun / testing), and it seems to be trying to autoload PDO. This leads me to believe that i开发者_开发问答t's not finding the PDO class it should be. I have checked php.ini and php_pdo.dll is enabled, along with php_pdo_mysql.dll, etc. The .dll files exist in "ext/" and I've restarted the web server numerous times.
I don't have much experience with IIS, but I've never had this issue on Linux, so I'm not sure what the issue is.
Any help would be greatly appreciated.
EDIT: PDO is not in phpinfo()
. I know it's not loaded correctly, I'm trying to figure out why. Here is my php.ini file: php.ini on Pasebin
C:\Program Files (x86)\PHP\ext is the extension directory, and listed as such in php.ini and phpinfo()
.
One thing I find odd is that you are specifying the extension in the [PDO]
section. I'm not aware of this kind of notation - my Windows php.ini doesn't do that. It could be that the line gets ignored because it gets interpreted as PDO.extension
which doesn't make sense.
What happens if you move the extension=php_pdo.dll
bit into the main body of the INI file (outside any []
section)?
If that doesn't change anything: Are you 100000% sure you are editing the correct php.ini?
With the extension specified in the file, PHP should either crash when you restart the server, or give you the PDO class.
Check phpinfo()
to see which ini file is being used exactly.
I am sure you have done most/all of the following things but here is what I would do:
1 : Look into IIS error log and see if it reports any issues (i havent worked with IIS in a while but i am sure there is an error log file somewhere)
2 : Make sure other .dll files are being loaded by cross checking in phpinfo()
3 : Comment out all the extensions like php_mbstring.dll, gd2 etc and see if that reflects in the phpinfo(), then start enabling one by one.
4 : Delete all the sections at bottom and simply put the extensions in the dynamic extensions section of the ini. something like
extension=php_abc.dll
extension=php_xyz.dll
extension=php_123.dll
5 : I have always been a bit reluctant on having spaces in directory names, so i would copy the ext folder to the root of c somewhere for testing, maybe something like c:\phpexts
6 : I would take the same php.ini and create a similar environment in apache (same php version) and see if it works or conversely port a php.ini from Apache to IIS.
Try opening cmd
and typing C:\Program Files (x86)\PHP\bin\php -r ""
.
Do you get an error message? If yes, what?
Make sure you have the correct extension for the Visual C++
version you're using with IIS.
If no, take that directory and move it to C:\
. It might be related to the spaces in the path. Adjust your IIS configuration and try again.
Good luck!
Just had this problem, check the permissions on the dll files, did the trick for me.
We had the same problem just check the variable extension_dir inside [WebPIChanges]
please look at this answer: this answer and in a conclusion you need to install php_sqlsrv_7_nts_x86.dll in your extensions.
you can download it from here
精彩评论