5

I have PHP 5.2.14 installed on a Windows box (installed via .msi) using Apache 2.2.16. The install came with both ext/php_mcrypt.dll and libmcrypt.dll but when I uncommented extension=php_mcrypt.dll in php.ini and restarted Apache it doesn't enable. phpinfo() shows nothing for it. What am I missing?

UPDATE:

I looked at my error logs and it spit this out to me:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP5\ext\php_mcrypt.dll' - The specified module could not be found.\r\n in Unknown on line 0

I read up a bit about this and I don't have any php dll's stored in the windows32/ folder, so I'm confused.

justacoder
  • 2,684
  • 6
  • 47
  • 78
  • 2
    Are you sure you are editing the correct `php.ini` file? Check your phpInfo() to see wich ini file gets loaded.. – Cyclonecode Nov 25 '11 at 15:48
  • I also recommend uniform server with the latest php and mysql =) you can change there easily between production and development ini file –  Nov 25 '11 at 15:49
  • If the install wasn't on a production box and could afford the downtime, I would just install the latest version. – justacoder Nov 25 '11 at 16:47
  • Krister, the system shows C:\PHP\php.ini, which is the file that I edited. – justacoder Nov 25 '11 at 18:08
  • Is `C:\PHP5\ext` where php_mcrypt.dll is located? That path may be case-sensitive as well on Windows. If that path is not correct, try changing `extension_dir` in php.ini or try `extension=C:/path/to/php/ext/php_mcrypt.dll` – drew010 Nov 25 '11 at 21:03
  • @Angry Spartan Where you able to solve the problem? How did you do it? – NotGaeL Nov 28 '11 at 15:40
  • I tried putting the full path in for the extension to mcrypt but Apache wouldn't restart. I get the error **[warn] pid file C:/Program Files/Apache Software Foundation/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?** – justacoder Nov 28 '11 at 20:51

3 Answers3

3

The other answers has the necessary steps about check the \ext\php_mcrypt.dll exists and enable the extension in php.ini. Beside this, you need to copy {Your-PHP-Root}\libmcrypt.dll to {Your-Apache-Root}\bin, then restart apache, the problem should be solved.

Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
nemozhp
  • 79
  • 1
  • 7
1

I figured it out through a combination of tutorials:

  1. Added libmcrypt.dll to the System32 folder
  2. Uncommnted the include_path var in php.ini and added the path to ext
  3. Restarted Apache

Thankfully, no system reboot was required. Whether one or both of the above was necessary, it doesn't matter now that mcrypt is functioning. Thanks, everyone.

justacoder
  • 2,684
  • 6
  • 47
  • 78
0

You need to install it first, or maybe add the route to the library to your windows PATH enviroment variable, since you are working on windows. Try: http://www.php.net/manual/en/mcrypt.installation.php

(There you can read "If you wish to install mcrypt on Windows, you should also place libmcrypt.dll in the PATH of your system.")

How to set or edit an enviroment variable: http://www.support.tabs3.com/main/R10463.htm

NotGaeL
  • 8,344
  • 5
  • 40
  • 70
  • I added the Path to Windows to no avail, but if a restart is required then I have to schedule downtime for that to occur. – justacoder Dec 01 '11 at 16:44