January 29, 2016 (8 years ago)

How To Enable CURL for PHP 5 in Windows 7 64-bit

If you have PHP already installed and running on your Windows 7 environment, check if ext\php_curl.dll exists in your php installation directory. If so, enabling CURL would be a matter of uncommenting

in the php.ini file and restarting Apache.

If not, it's most likely a waste of time to attempt to find a compatible CURL package to install. Most likely, it's not the right one and will fail to load. Downloading a standalone php_curl.dll file is not likely to help either. The fastest solution is to upgrade PHP to a version with CURL included in the package.

The Right PHP Version

There are two kinds of PHP for Windows 7, x86 (32-bit) and x64 (64-bit). It's a common mistake to download the 64-bit PHP package if one has the Windows 64-bit operating system. What is needed is one that matches the Apache server being installed. Check whether Apache is installed in the C:\Program Files (x86)\ folder or the C:\Program Files\ folder. So now, you know which PHP version to choose. Apache in the folder marked (x86) is a 32-bit installation.

Choose a PHP Package for Windows

For a 32-bit Apache server to work with PHP, php-5.4.44-Win32-VC9-x86.zip is the recommended version as it already contains CURL but is not enabled by default. You will need to uncomment the line mentioned above.

A PHP version that closely or exactly matches your remote web host PHP version is also recommended. Check for ext\php_curl.dll in the package first before installing. If not, try another version which is close.

Installing the wrong bit package will give the following error when starting Apache.

Cannot load C:/php/php5apache2_2.dll into server: %1 is not a valid Win32 application.

To check if CURL has successfully loaded with the Apache server, type phpinfo(); in a php file and view the page in the browser. A configuration table with the title "curl" should be found in the page.