Curl is not setup on this php server and is required for this script

Question

Hello

I have a droplet that is running WordPress on Ubuntu 13.10 and I installed a WordPress plugin give this “cURL is NOT installed in your PHP installation” what do I need to do?

Thank you


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.
    Curl is not setup on this php server and is required for this script
  • 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.

Curl is not setup on this php server and is required for this script

  • Example:

            $ch = curl_init();

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

            $output = curl_exec($ch);

            echo $output;

            curl_close($ch);     

    ?>

  • Output: This page of GeekforGeeks is now rendered on my localhost running the Apache server. The HTML content is “echoed” as the output.
    Curl is not setup on this php server and is required for this script

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.


How do I enable cURL in PHP?

cURL is enabled by default but in case you have disabled it, follow the steps to enable it..
Open php. ini (it's usually in /etc/ or in php folder on the server)..
Search for extension=php_curl. dll. Uncomment it by removing the semi-colon( ; ) in front of it..
Restart the Apache Server..

How do I know if cURL is enabled in PHP?

Create phpinfo. php file and save. phpinfo; ?> Then go to http://domainname/phpinfo.php to check whether CURL is enabled or not.

How install PHP cURL Linux?

Following are the steps for the installation of PHP-CURL on your Ubuntu system:.
Step 1: Install PHP libraries for the server by running the following command: $ sudo add-apt-repository ppa:ondrej/php..
Step 2: Then, update the server: $ sudo apt update..
Step 3: Now, install CURL..

How do I enable cURL on Linux server?

The procedure to install cURL on Ubuntu Linux is as follows: Update your Ubuntu box, run: sudo apt update && sudo apt upgrade. Next, install cURL, execute: sudo apt install curl. Verify install of curl on Ubuntu by running: curl --version.