• Problems with PHP 5.5.18, CURL, Windows 8 and WordPress bleeding edge

    I recently upgraded my development environment to PHP 5.5.18 with Apache 2.4. Everything seemed to be working fine.

    But when I tried to upgrade my bleeding edge WordPress environment to WordPress 4.1-beta2 it failed with.

    Download failed.: There are no HTTP transports available which can complete the requested request. 
    

    I spent some time analysing the problem and found it to be that I hadn’t enabled CURL. But when I did enable CURL, it still didn’t work.

    Looking at the number of reports in Stack Overflow this seems to have been a fairly common problem, with a variety of workarounds, many of which don’t actually address the basic issue. Here’s my solution.

    Problem statement

    • Apache is configured to start as a service
    • The CURL extension is enabled in php.ini
      extension=c:\php\ext\php_curl.dll
      
    • You have stopped and restarted Apache
    • But CURL is not working

    Problem solution

    • Ensure that your system PATH environment variable contains the directory in which PHP is installed.
    • Stop the Apache server and restart it once more. With luck CURL will start working.

    Explanation

    Assume PHP is installed in c:\php

    • When Windows is starting the Apache service the PATH environment variable is set to the system version.
    • Windows uses the path to discover the DLLs that are needed by the program.
    • The CURL extension ( php_curl.dll, located in c:\php\ext ) is dependent upon a number of DLLs including: libeay32.dll, ssleay32.dll and (since 5.5.17) libssh2.dll
    • The PHP provided DLLs are located in c:\php
    • If Apache cannot load the DLL due to dependencies not being satisfied then it does so silently.

    Therefore, if you’ve attempted to configure your php.ini to load the php curl extension but not included c:\php in your path environment variable then the php_curl.dll won’t get loaded and CURL functions won’t work; since they won’t actually exist.

    Notes:

  • The version of PHP that I’m using is 5.5.18.
  • I believe this solution also applies to PHP 5.6.1.
  • It might also have fixed many of the problems reported on Stack Overflow.
  • You may also find libeay32.dll and ssleay32.dll in your Apache bin directory. These should cause no harm.
  • When CURL is not loaded you might get
    Fatal error: Call to undefined function curl_init()
    
  • You don’t get the Fatal error in WordPress since the code checks for the existence of the curl_init() function in WP_Http_Curl::test()

Related reading


, ,

Published:

Last updated:

November 21, 2014

Categories

Tide times from tidetimes.co.uk

Tide Times & Heights for Langstone Harbour on
Sunday, 05 December 2021
Low Tide:04:44 ( 0.70m )
High Tide:11:51 ( 5.10m )
Low Tide:17:08 ( 0.60m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
5th December 2021
04:44 Low Tide ( 0.47m )
11:47 High Tide ( 5.12m )
17:11 Low Tide ( 0.33m )