Why can't PHP on Windows see extension php_intl.dll even though it exists?

南楼画角 提交于 2019-11-27 03:26:25

问题


I've been trying to get the intl extension working on my test workstation (PHP 5.5.1, Apache 2.2.4, Windows 7 32-bit). It seems that no matter what I try I can't get it up and running.

  • I've uncommented the line "extension=php_intl.dll" in my php.ini.
  • I've verified the extension_dir directive is pointing at the correct directory (c:\wamp\php5.5\ext).
  • I've verified php_intl.dll is in c:\wamp\php5.5\ext.
  • I've verified that all the icu*.dll files are present in the php root directory (c:\wamp\php5.5).
  • I've verified that c:\wamp\php5.5 is in my PATH.
  • And yes, the copy of php.ini I'm editing is the correct one, the one specified by the PHPIniDir directive in httpd.conf.

I've checked the Apache error log and found this line every time I've restarted Apache:

PHP Warning: PHP Startup: Unable to load dynamic library 'c:\wamp\php5.5\ext\php_intl.dll' - The specified module could not be found.\r\n in Unknown on line 0

I repeat myself, but c:\wamp\php5.5\ext\php_intl.dll DOES EXIST!

I'm tempted to try pointing at Windows Explorer and shouting at my computer, "LOOK! THE STINKIN' FILE IS RIGHT THERE!" Any idea why I can see the file and PHP cannot even though we're apparently looking in the same directory? Or is something else going on that I've missed?


回答1:


Make sure that Apache can find and load icu*.dll files from PHP base dir.

Fast, simple solution is to copy these dll's to Apache bin directory.




回答2:


Although SeventyFourLaboratories's solution is simple and it works, there is a solution that doesn't require you to modify your Apache or PHP distribution (and sometimes, you are not allowed to change them in production servers).

You said you've verified C:\wamp\php5.5 is in your PATH. Windows has two kinds of environment variables: user and system variables.

I've tried to set C:\wamp\php5.5 in my user variable PATH, and it doesn't work. But, setting it in the system variable PATH makes it work. So, you should verify that you use the PATH system variable to configure Apache instead of a user variable with the same name.




回答3:


I had this exact same problem and after close to 5 hours of working on this issue I finally got it resolved. There were two main changes that I had to make.

1) When I downloaded the extension I was trying to use, it came with many other files beyond just the .dll file - most of them were .pdb. I moved all of them into the ext folder that contains the .dll files.

2) The answer by smaines at alaya dot com provided as a comment here gave me the second thing that I needed to do - add the path to the ext folder to windows $PATH variable.

There are many ways this can be done, here is one:

  • Go to my computer
  • Right click and select properties
  • Click 'Advanced system settings' on the left
  • Click on the 'Advanced' tab at the top
  • Click the 'Environment Variables' button
  • Search through the list of variables to find the 'Path' variable, select it
  • Click the 'Edit...' button (when the 'Path' variable is selected)
  • This will bring up another dialog box with two input fields. The bottom one is the variable, select it.
  • Append to the end a semicolon then the path, in this case you would type ';C:\wamp\php5.5\ext' (the semicolon is just to separate it from the previous path
  • click 'OK' in all the dialog boxes that have come up to close them

After making the above changes you need to restart your machine for them to take affect.

I hope that helps, it worked for me. It seems like this is a fairly common problem - at least I found quite a few discussions on it and variations of it.




回答4:


This was driving me crazy. I had all the icu dlls in my path etc. In the end installing Visual C++ 2015 x86 solved it for me.




回答5:


complete fix would be to change C:\wamp\scripts\config.inc.php as follow:

Find this section of that file

$phpDllToCopy = array (
'fdftk.dll',
'fribidi.dll',
'libeay32.dll',
'libmhash.dll',
'libmysql.dll',
'msql.dll',
'libmysqli.dll',
'ntwdblib.dll',
'php5activescript.dll',
'php5isapi.dll',
'php5nsapi.dll',
'ssleay32.dll',
'yaz.dll',
'libmcrypt.dll',
'php5ts.dll',
'php4ts.dll');

And change it to

$phpDllToCopy = array (
'fdftk.dll',
'fribidi.dll',
'icudt51.dll', // - Additions to avoid unknown error PHP 5.5.5
'icuin51.dll',
'icuio51.dll',
'icule51.dll',
'iculx51.dll',
'icutest51.dll',
'icutu51.dll',
'icuuc51.dll',
'icudt50.dll', // - Additions to avoid unknown error PHP 5.5
'icuin50.dll',
'icuio50.dll',
'icule50.dll',
'iculx50.dll',
'icutest50.dll',
'icutu50.dll',
'icuuc50.dll',
'icudt49.dll', // - Additions to avoid unknown error PHP 5.3/5.4
'icuin49.dll',
'icuio49.dll',
'icule49.dll',
'iculx49.dll',
'icutest49.dll',
'icutu49.dll',
'icuuc49.dll',
'libeay32.dll',
'libmhash.dll',
'libmysql.dll',
'libsasl.dll', // - Additions to avoid unknown error
'msql.dll',
'libmysqli.dll',
'ntwdblib.dll',
'php5activescript.dll',
'php5isapi.dll',
'php5nsapi.dll',
'ssleay32.dll',
'yaz.dll',
'libmcrypt.dll',
'php5ts.dll',
'php4ts.dll',
);



回答6:


HOW TO add your PHP.exe location to PATH.

(Windows 7 GUI)

For admin access to "Environment Variables : System Variables", follow instruction here: https://kb.wisc.edu/cae/page.php?id=24500

In "Environment Variables : System Variables", edit the 'Path' variable and prefix the existing string (DO NOT DELETE IT), with your location. eg: C:\wamp\bin\php\php5.5.12;

  • Worked for me.



回答7:


Correction to above messages

If you are adding php folder to PATH, make sure to add php folder, not the php/ext folder.

In my case it was C:\wamp\bin\php\php5.5.12, not C:\wamp\bin\php\php5.5.12\ext.



来源:https://stackoverflow.com/questions/17976764/why-cant-php-on-windows-see-extension-php-intl-dll-even-though-it-exists

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