Php установить curl linux

How can I enable cURL for an installed Ubuntu LAMP stack?

I have installed the Ubuntu LAMP stack. But cURL is not enabled, and neither can I can find the extension listed in the INI file. I added it manually, but it didn’t work either. How should I enable cURL then?

10 Answers 10

sudo apt-get install php5-curl 

After installing libcurl, you should restart the web server with one of the following commands,

sudo /etc/init.d/apache2 restart 
sudo service apache2 restart 

@Arsheep «didn’t worked» is exceedingly unhelpful. Did it give you an error? Did your computer explode? Did your house burst into flames?

No errors and no flames man , it installed successfully i restarted Apache and retried the curl code But the same error again » Call to undefined function curl_init() «

You only need to install php5-curl. The rest aren’t required to enable curl in PHP. I also didn’t have to restart Apache for the change to take effect.

This answer is old, for example ubunto 14.10 now changes the libcurl3 dependencies to libcur4. Here’s what I used successfully (it also pulled in a few more dependencies as this was a first-time install for me): sudo apt-get install curl libcurl4-openssl-dev php5-curl php5-cli

You only have to install the php5-curl library. You can do this by running

sudo apt-get install php5-curl 

@EdC In my opinion this is a better answer than the accepted, because it’s enough to install php5-curl, no need for the others.

This is the better answer. simpler and there is no need to restart the webserver because apt-get does it for you

@mblackwell8 I just tried, and you MUST restart the web server after using the command in order for it to work.

Correct, an apache restart is required. FYI you could also enter: sudo /etc/init.d/apache2 restart (instead of ‘sudo service apache2 restart) . though this alternative method I mention requires that your directory is unchanged as it specifies a static path. I use the one mentioned by Yazin

sudo apt-get install php-curl 

It worked on a fresh Ubuntu 16.04 (Xenial Xerus) LTS, with lamp-server and php7. I tried with php7-curl — it didn’t work and also didn’t work with php5-curl .

This work perfectly fine with me. I’m using PHP7 but I used the command without the version number and it worked super fine. Thanks.

For those who are trying to install php-curl on PHP 7, it will result in an error. Actually if you are installing php-curl in PHP 7, the package name should be;

sudo apt-get install php-curl 

Not php5-curl or php7-curl , just php-curl .

Читайте также:  Команда очистки файла linux

First thing to do: Check for the PHP version your machine is running.

This will show something like this (in my case):

PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group

If you are using PHP 5.x.x => run command: sudo apt-get install php5-curl

If PHP 7.x.x => run command (in my case): sudo apt-get install php7.0-curl

Enable this extension by running:

sudo gedit /etc/php/7.0/cli/php.ini 

And in the file «php.ini» search for keyword «curl» to find this line below and change it from

Next, save your file «php.ini».

Finally, in your command line, restart your server by running: sudo service apache2 restart .

I tried most of the previous answers, but it didn’t work for my machine, Ubuntu 18.04 (Bionic Beaver), but what worked for me was this.

First: check your PHP version

Second: add your PHP version to the command. Mine was:

 $ sudo apt-get install php7.2-curl 

Lastly, restart the Apache server:

sudo service apache2 restart 

Although most persons claimed that it not necessary to restart Apache 🙂

Not need to specify the php version, just use: sudo apt-get install php-curl and sudo service apache2 restart

Fire the below command. It gives a list of modules.

 sudo apt-cache search php5- 

Then fire the below command with the module name to be installed:

 sudo apt-get install name of the module 

You don’t have to give version numbers. Just run:

sudo apt-get install php-curl 

It worked for me. Don’t forgot to restart the server:

sudo service apache2 restart 
sudo apt-get install -y curl 

Well for does of you who are using PHP 8.x above and Centos OS 7 you can install the php extension by running this command yum search php81- or php80 then search for ea-php81-php-curl.x86_64 or ea-php80-php-curl.x86_64

After that run: yum install ea-php81-php-curl.x86_64 to install the extension. This will also restarted the apache server along side the installation.

Hope this help solve your problem!

This question is in a collective: a subcommunity defined by tags with relevant content and experts.

Источник

How To Install php-curl on Ubuntu 22.04

In this tutorial we learn how to install php-curl on Ubuntu 22.04.

What is php-curl

This package provides a CURL module for PHP.

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

This package is a dependency package, which depends on Debian’s default PHP version (currently 8.1).

There are three ways to install php-curl on Ubuntu 22.04. We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.

Install php-curl Using apt-get

Update apt database with apt-get using the following command.

After updating apt database, We can install php-curl using apt-get by running the following command:

sudo apt-get -y install php-curl 

Install php-curl Using apt

Update apt database with apt using the following command.

Читайте также:  Линукс узнать версию биоса

After updating apt database, We can install php-curl using apt by running the following command:

sudo apt -y install php-curl 

Install php-curl Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

After updating apt database, We can install php-curl using aptitude by running the following command:

Источник

How to install php-curl on Ubuntu 20.04 (Focal Fossa)?

In this article we are going to learn the commands and steps to install php-curl package on Ubuntu 20.04 (Focal Fossa).

Quick installation of php-curl Architecture: all Version: 2:7.4+75:

Step 2: Install: php-curl Architecture: all Version: 2:7.4+75

Ater updaing the OS run following command to install the packae:

sudo apt-get install php-curl Architecture: all Version: 2:7.4+75

How to install php-curl Architecture: all Version: 2:7.4+75 on Ubuntu 20.04 LTS?

First of all update your system with the command:

Above command will download the package lists for Ubuntu 20.04 LTS on your system. This will update the list of newest versions of packages and its dependencies on your system.

After downloading the latest package list with the help of above you can run the installation process.

If php-curl Architecture: all Version: 2:7.4+75 is not installed on your compter then the command ‘dpkg -L php-curl Architecture: all Version: 2:7.4+75’ will give followin error.

deepak@deepak-VirtualBox:~$ dpkg -L php-curl [1mdpkg-query:[0m package 'php-curl' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. deepak@deepak-VirtualBox:~$

Installing php-curl Architecture: all Version: 2:7.4+75:

After system update use the following command to install php-curl Architecture: all Version: 2:7.4+75:

sudo apt-get install php-curl Architecture: all Version: 2:7.4+75

Above command will confirm before installing the package on your Ubuntu 20.04 LTS Operating System. If you are not already logged in as su, installer will ask you the root password. After completion of the installation you can use the package on your system.

How to uninstall/remove php-curl Architecture: all Version: 2:7.4+75 from Ubuntu 20.04 LTS?

Now we will see the commands for uninstalling the php-curl Architecture: all Version: 2:7.4+75 from Ubuntu 20.04 LTS. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.

To remove the php-curl Architecture: all Version: 2:7.4+75 following command is used:

sudo apt-get remove php-curl Architecture: all Version: 2:7.4+75

Following command is used to remove the php-curl Architecture: all Version: 2:7.4+75 package along with its dependencies:

sudo apt-get remove --auto-remove php-curl Architecture: all Version: 2:7.4+75

This will remove php-curl Architecture: all Version: 2:7.4+75 and all its dependent packages which is no longer needed in the system.

Читайте также:  Linux delete files older than file

Completely removing php-curl Architecture: all Version: 2:7.4+75 with all configuration files:

Following command should be used with care as it deletes all the configuration files and data:

sudo apt-get purge php-curl Architecture: all Version: 2:7.4+75

or you can use following command also:

sudo apt-get purge --auto-remove php-curl Architecture: all Version: 2:7.4+75

Above command will remove all the configuration files and data associated with php-curl Architecture: all Version: 2:7.4+75 package. You can can’t recover the delete data, so, use this command with care.

Copyright © DevManuals.net 2016

Источник

How to Install PHP Curl Extension in Ubuntu?

In this tutorial, we will go over the demonstration of how to install php curl extension in ubuntu. This post will give you a simple example of ubuntu php install curl extension. I’m going to show you about install php curl extension ubuntu 20.04. you will learn install php curl extension ubuntu.

We can install php curl extension using php-curl library. i will give you following list of commands to install php curl extension in ubuntu 22.10, ubuntu 22.04, ubuntu 21.10, ubuntu 21.04, ubuntu 20.04, ubuntu 18.04 and ubuntu 16.04 server.

You need to run both command one by one:

sudo apt-get install php-curl

Solution for PHP 8.2

You need to run both command one by one:

sudo apt-get install php8.2-curl

Solution for PHP 8.1

You need to run both command one by one:

sudo apt-get install php8.1-curl

Solution for PHP 8.0

You need to run both command one by one:

sudo apt-get install php8.0-curl

Solution for PHP 7.4

You need to run both command one by one:

sudo apt-get install php7.4-curl

Solution for PHP 7.3

You need to run both command one by one:

sudo apt-get install php7.3-curl

Solution for PHP 7.2

You need to run both command one by one:

sudo apt-get install php7.2-curl

Hardik Savani

I’m a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.

We are Recommending you

  • How to Find php.ini File in Ubuntu?
  • How to Check Current PHP Version in Ubuntu?
  • How to Check Apache Access & Error Log Files in Ubuntu Server?
  • How to Whitelist/Allow IP Address in Apache Ubuntu?
  • How to Restrict/Block IP Address in Apache Ubuntu?
  • How to Install Apache PHP MySQL and Phpmyadmin on Ubuntu?
  • How to Install MySQL in Ubuntu Server?
  • How to Upgrade PHP Version from 7.4 to 8 in Ubuntu?
  • How to Install Yarn npm in Ubuntu?
  • How to Upgrade PHP Version from 7.2 to 7.3 in Ubuntu?
  • How to Enable Apache mod_rewrite Module in Ubuntu?
  • How to create quick apache virtual host in Ubuntu?
  • How to Install Sublime Text Editor in Ubuntu?

Источник

Оцените статью
Adblock
detector