Fatal Error: Google PHP API Client requires the CURL PHP extension

4,097 views
Skip to first unread message

sldahlin

unread,
Sep 11, 2012, 5:34:33 PM9/11/12
to google-api...@googlegroups.com
I have a problem testing the google api.  I am getting a "Fatal error: Uncaught exception 'Exception' with message 'Google PHP API Client requires the CURL PHP extension' in C:\apps\appsdev\wamp\2.2e2\www\Website\google-api-php-client\src\apiClient.php on line 20". 

I have wampp installed. The php.ini shows the correct extension_dir and the extension php_curl.dll is uncommented and the dll exists. I have also restarted the server several times.  Furthermore I ran procmon.exe in the background and verified that the php_curl.dll is found successfully.  My code is as follows:

<?php
session_start();

require_once "google-api-php-client/src/apiClient.php";
require_once "google-api-php-client/src/contrib/apiCalendarService.php";

$apiClient = new apiClient();
$apiClient->setUseObjects(true);
$service = new apiCalendarService($apiClient);

if (isset($_SESSION['oauth_access_token'])) {
  $apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
  $token = $apiClient->authenticate();
  $_SESSION['oauth_access_token'] = $token;
}

?>

and apiClient.php is part of the google php client lib.  The offending line is:

if (! function_exists('curl_init')) {
  throw new Exception('Google PHP API Client requires the CURL PHP extension');
}

all the references on this say do all the things I have already done and indeed procmon indicates it is finding php_curl.dll.  I am unclear how to proceed.  Any suggestions?

Thanks

Chirag Shah

unread,
Sep 11, 2012, 7:12:48 PM9/11/12
to google-api...@googlegroups.com
Hi Steven,

The line you're hitting basically throws an exception if the function "curl_init" isn't available, which occurs when the libcurl extension isn't loaded.
It appears that others are also having issues enabling libcurl with Wamp on stackoverflow.

The following two stackoverflow threads might help steer you in the right direction:

You also want to double check that you're editing the correct php.ini file. You can double check by running:
print get_cfg_var('cfg_file_path');

That will print out the path to your php.ini file. Make sure you're editing that file.
Reply all
Reply to author
Forward
0 new messages