简体   繁体   中英

Error like this: Google PHP API Client requires the CURL PHP extension

When i am trying to use google API in my PHP project it gives error like this:

Fatal error: Uncaught exception 'Exception' with message 'Google PHP API Client requires the CURL PHP extension' in C:\\xampp\\htdocs\\googleplus\\src\\Google_Client.php:21 Stack trace: #0 C:\\xampp\\htdocs\\googleplus

I have curl installed in my laptop.

If you are using window then follow these steps to enable curl in php

Step 1. Open below 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

If you are using Linux operating system

Open terminal using ctrl + alt + t

Run command :- sudo apt-get install php5-curl // Note :- according to php version

Make sure curl is enabled in the php.ini file path /etc/php5/apache2/php.ini,

Restart apache server :- sudo service apache2 restart

For php7.2 version in Ubuntu:

sudo apt-get install php7.2-curl

sudo systemctl restart apache2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM