1

I am creating a Facebook app using php...downloaded the php-sdk from github but everytime I run the file I get this error ---

Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension.

I have removed the comment from php.ini file stored in xampp/php but still I'm getting the same error.

user3168567
  • 23
  • 1
  • 7

3 Answers3

6

If you Operating System is Ubuntu

To solve this exception ,you need to download curl for php5 .

1) Just run this command line from your terminal :

sudo apt-get install php5-curl

2) Then restart your apache :

sudo /etc/init.d/apache2 restart
ahmed hamdy
  • 5,096
  • 1
  • 47
  • 58
1

Check your changes,

<?php phpinfo(); ?>

CURL support enabled is necessary.

Enabling CURL in PHP (PHP.ini, WAMP, XAMPP, Ubuntu).

Following steps to enable curl library with XAMPP in Windows:

Step 1:

Browse and open the following 3 files

C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini

Step 2:

Uncomment the following line in your php.ini file by removing the semicolon (;).

;extension=php_curl.dll

After that it will look something like something below-

extension=php_curl.dll

Step 3:

Restart your Apache server.

Step 4:

Check your phpinfo() to see whether curl has properly enabled or not.

Tony Stark
  • 8,064
  • 8
  • 44
  • 63
0

Do you see the changes when you output

<?php phpinfo() ?>

Maybe you forgot to restart your apache server after you made the changes?

tally
  • 11
  • 2
  • no i did restart the apache server but still getting the error – user3168567 Jan 10 '14 at 10:26
  • are the changes indeed reflected in the phpinfo() output.. otherwise you're probably are changing the wrong php.ini file.. the correct location is also in the phpinfo() output :) – tally Jan 10 '14 at 10:31
  • some usefull hints here : http://stackoverflow.com/questions/3020049/how-to-enable-curl-in-xampp – tally Jan 10 '14 at 10:33