Install MCrypt for PHP on Windows
There are many sites around explaining how to install MCrypt for windows but none seem very straight forward.
I have PHP installed on a windows development machine and I need MCrypt installed.
The default installation might not have mcrypt or you might have missed it shomehow…
If that happens all you need to do it
- Go to the php download website and download the windows binary package, (not the installer).
- Unzip the file in a folder, (it should create a folder called something like php-5.x.yy-Win32, depending on the version number of php you got.
- In that folder there should be a file called “libmcrypt.dll”, copy the file to your php extension folder, (see below if you don’t know where that is).
- In that folder there should also be another folder called “ext”, open it and copy the file “php_mcrypt.dll” to your php extension folder.
- edit your php.ini file, (see below if you don’t know where that is), and add the line:
…
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
…
extension=php_mcrypt.dll
…
Look for other “extension=…” to find where to add this line.
- Restart your web server, with Apache for example click on the icon on the task bar and select ‘restart’.
Where are my php extensions?
Normally they are located in your program files directory, something like “C:\Program Files\PHP\“, if you are using a non english version of Windows then the name might be different.
If it is not there then create a phpinfo.php test file and look for the path in the various variables, (look for the variables extension_dir as well as PHPRC).
Where is my php.ini file?
Same as above, normally they are located in your program files directory, something like “C:\Program Files\PHP\“, if you are using a non english version of Windows then the name might be different.
If it is not there then create a phpinfo.php test file and look for the path in the various variables, (look for the value “Loaded Configuration File“).
What should my phpinfo.php file look like?
Open a blank file with your favourite text editor and type.
<?php
phpinfo();
?>
Save the file as phpinfo.php in your web folder and it should show you all the information you need about your php installation.
Recent Comments