Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

intl

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?

like image 695
PerceptorII Avatar asked Jul 31 '13 17:07

PerceptorII


People also ask

How do I enable PHP extensions in Windows?

On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way. To load an extension, you need to have it available as a ". dll" file on your system.

What is Php_intl?

The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.


2 Answers

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.

like image 141
SeventyFourLaboratories Avatar answered Oct 29 '22 02:10

SeventyFourLaboratories


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.

like image 43
rchavarria Avatar answered Oct 29 '22 01:10

rchavarria