If you getting error like php7.2-curl
doesn't have installable candidate or not locate any package or dependencies is php7.2-common
Or libcurl3
Do this
You have to tackle in mature way. Install aptitude these ubuntu package manager will finds all dependencies, and will install one by one.
apt-get install aptitude
Now you have to check if aptitude can download it or not if download it follow instructions
sudo aptitude install php7.2-curl
If you have gotten any error like this
E: Unable to locate package php7.2-curl
E: Couldn't find any package by glob 'php7.2-curl'
Any type on error i'm not talking about proper these errors
Try to add php package again
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
Now try this command
sudo aptitude install php7.2-curl
Aptitude will ask you you want to keep current version of all dependencies
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1] php7.2-curl [Not Installed]
Accept this solution? [Y/n/q/?]
Type n
then Enter
Aptitude will find all dependencies and ask you to install all package type
y
Again
y
Then
systemctl restart apache2
For centos of rhel
systemctl restart httpd
It will Not enabling PHP 7.2 FPM by default. NOTICE: To enable PHP 7.2 FPM in Apache2 do
a2enmod proxy_fcgi setenvif
a2enconf php7.2-fpm
This method is not only for this error you can find any of php apache2 or ubuntu system package solution using aptitude.
Upvote if you find your solution
Enable php curl module by removing the ; from the ;extension=curl in php.ini file.
Find ;extension=curl in php.ini file and remove ; from it or just place extension=curl in case you did not find the ;extension=curl in php.ini.
Question
I am running a script and I have this Fatal error: Call to undefined function curl_init[] in /var/www/html/wp-content/plugins/accesspress-social-login-lite/twitter/twitteroauth.php on line 189
it appears curl is not enabled in my install, how may I go about it?
Submit an answer
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sign In or Sign Up to Answer
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Often, web applications require HTTP based UserID and Password authentication, cookies, and form uploads. Even, user authentication with Google or Facebook sign-in is done via HTTP. In these types of cases, we need to request a particular service server[Like Google’s] for user validation and authentication token on our server. The entire process takes place through the service server’s APIs. The cURL helps our web applications to interact/communicate with those APIs on the HTTP level.
cURL: It is a library created by Daniel Stenberg. The cURL stands for client URL. It allows us to connect with other URLs and use their responses in our code. The cURL is a way that can hit a URL from our code to get an html response from it. The cURL is also used in command lines or scripts for data transfer. cURL with respect to PHP is a library that lets us make HTTP requests in PHP. It’s easier to do GET/POST requests with curl_exec to receive responses from other servers for JSON format data response and to download files.
Required to “enable” cURL: The cURL, by default, is not enabled in Apache. If we try to run CURL programs without enabling CURL in Apache, the browser will throw an error.
Fatal error: Call to undefined function curl_init[]
.
To avoid this, we need to enable the CURL extension in the Apache server
with the following methods in different environments.
Enable CURL in Apache: Enabling CURL in Apache by configuring php.ini file.
- Step 1: Locate PHP.ini file, it is mostly in the server’s root folder or public_html then open the PHP.ini in a text editor
- Step 2: Search or find the ;extension=php_curl.dll with Ctrl+F and remove the semi-colon ‘;’ before it
to activate it.
- Step 3: Save and Close PHP.ini with Ctrl+S and restart Apache from terminal/CMD
Enabling cURL in WAMP: WAMP is a software stack available for Windows that bundle Apache, MySQL, and PHP together. It’s an installation pack for installing the three web technologies on the Windows environment together in a hassle-free GUI guided fashion.
Enabling CURL in Ubuntu: Run the following command:
- This command installs the PHP CURL.
sudo apt-get install php5-curl
- This command starts with the Apache server.
sudo service apache2 restart
Check if CURL is enabled or not: If we try to run a cURL PHP program without cURL being enabled, the browser will throw the following
error.
- Example:
- Output: This page of GeekforGeeks is now
rendered on my localhost running the Apache server. The HTML content is “echoed” as the output.
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.