Pivotal Knowledge Base

Follow

How to enable cURL extension in PHP on Windows ERS-4.0.3, Apache-2.2.x (2041904_draft)

 

Purpose

How to  enable cURL extension in PHP on Windows ERS-4.0.3, Apache-2.2.x

Resolution

In order to enable PHP's cURL support on ERS-4.0.3, Apache 2.2.x,  you will need to install php_curl.dll along with the requires libeay32.dll and ssleay32.dll dependency libraries.

For example, here are the instructions for setting up cURL in PHP:

1)  Find out what version of PHP your ERS4 is bundled with:

C:\ERS-4.0.3\php4.4\bin\php -v
PHP 4.4.8 (cli) (built: Feb  7 2011 22:35:08)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

2)  Download and extra a pre-compiled php-4.4.8-Win32.zip binary package of the same PHP version that's bundled with ERS-4.0.3 from here:

http://museum.php.net/


3)  Copy ssleay32.dll and libeay32.dll from php-4.4.8-Win32\dlls folder to %systemroot%/system32 folder.

4)  Create a folder to store the cURL extension:

C:\> mkdir C:\ERS-4.0.3\php4.4\ext
 
5)  Copy php-4.4.8-Win32\extensions\php_curl.dll library to C:\ERS-4.0.3\php4.4\ext folder.
 
6)  Find and edit the following two lines in C:\ERS-4.0.3\php4.4\etc\php.ini file to load cURL PHP extension:
 
;  Specify the folder path where the extensions (curl extension) are stored.
extension_dir = "C:\ERS-4.0.3\php4.4\ext"
;  Enable cURL extension in PHP
extension=php_curl.dll

7)  Create a phpinfo.php page to see if the curl extension is loaded successfully.

<? php
phpinfo();
?>

8)  Restart Apache instance and point your browser to phpinfo.php page and you should see cURL extension info, like:

curl support enabled
curl information libcurl/7.16.0 OpenSSL/0.9.8r zilb/1.2.3

Here's a sample cURL code to test if cURL is working or not:

<?php
//  Create a curl handle  
$ch = curl_init(); 
   
// Set the options, including the url 
curl_setopt($ch, CURLOPT_URL, "http://www.google.com/"); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
   
// Execute and fetch the resulting HTML output 
$output = curl_exec($ch); 
echo "$output\n";

// Get curl request info
$info = curl_getinfo($ch); 
echo 'Took ' . $info['total_time'] . ' seconds for url ' . $info['url'];

// Free up the curl handle 
curl_close($ch); 
?>

Instead for using mod_php, we advise users to which over to using mod_fcgid with PHP or better yet upgrade to vFabric Web Server (vFWS) for the following reasons:

  •   ERS is deprecated and VMware is no longer providing maintenance update fixes or patches.
  •   The End-of-Life (EOL) commercial support for ERS is around June 2013.
  •   Users are encourage to upgrade ERS to vFabric Web Server (vFWS) and use mod_fcgid with PHP.
  •   VMware does not ship vFWS with mod_php, but it bundled with a high performance mod_fcgid as a preferred alternative solution to running mod_php.
  •   Run multiple PHP versions for different applications on a web server using mod_fcgid.

For more info, see these KB articles:

Additional Information

Client URL (cURL) Library -  http://php.net/manual/en/book.curl.php
 
©VMware 2013

Comments

Powered by Zendesk