Php включить curl ubuntu

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:

sudo aptitude -y install php-curl 

How To Uninstall php-curl on Ubuntu 22.04

To uninstall only the php-curl package we can use the following command:

sudo apt-get remove php-curl 

Uninstall php-curl And Its Dependencies

To uninstall php-curl and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove php-curl 

Remove php-curl Configurations and Data

To remove php-curl configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge php-curl 

Remove php-curl configuration, data, and all of its dependencies

We can use the following command to remove php-curl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge php-curl 

References

Summary

In this tutorial we learn how to install php-curl package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.

Источник

How To Enable PHP cURL Extension?

Are you looking for the multiple way to enable PHP cURL extension into your server? In this article, we’ll share some of way to enable PHP cURL extension.

To enable the PHP-cURL extension onWindows systems

  1. Open php.ini file located under php installation folder.
  2. Search for extension=php_curl.dll.
  3. Uncomment it by removing the semi-colon(;) in front of it.
  4. Restart the Apache Server.

To enable the PHP-cURL extension on Linux Ubuntu/Debian, you must first install it with the command:

sudo apt-get install php-curl

Or so for the old PHP5 version:

sudo apt-get install php5-curl

You can activate/deactivate the PHP module like this:

sudo phpenmod curl sudo phpdismod curl

Restart Apache2 to apply the changes:

sudo /etc/init.d/apache2 restart

Check if curl is activated:

How to enable CURL via the php.ini file by cPanel

Step 2: Navigate to the Files section and click the file manager icon.

Step 3: Navigate to the public_html directory and find the php.ini file.

Step 4: Select the php.ini file and right-click to edit button.

Step 5: You will appear a popup window and click on the Edit button and proceed.

Step 6: A new tab will appear in the browser and add the below code in your php.ini file
extension=php_curl.dll
Save the file, now you have successfully enabled the CURL extension.

I hope that this article will help you to How to enable PHP cURL extension.

If you have any query then please let me know in the comments section. If you think this post saved your time, please subscribe to our newsletter for regular updates.

Источник

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?

Источник

How to enable cURL in PHP?

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.

  • Step 1: Left-click on the WAMP server icon in the bottom right of the screen.
  • Step 2: PHP -> PHP Extensions ->curl.

Enabling CURL in Ubuntu: Run the following command:

    This command installs the PHP CURL.

sudo apt-get install php5-curl
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.

Источник

Читайте также:  Http www hyundai auto ru forums viewtopic php
Оцените статью