Php yum install curl

How to install cURL and Check CURL is enabled or available in Web Server using PHP

This tutorial will show you how to install cURL and check whether cURL is enabled or not in your web server. cURL is a command line tool for transferring the data from one server to another by accepting multiple types of request.

In another way, cURL (Transfer a URL) is a very lightweight command line tool which handles the HTTP request without sending explicit request from browser.

cURL supports multiple protocol like SMTP, SMTPS, HTTP, HTTPS etc. Most of the web applications are using cURL to handle their API request.

As per Wikipedia, cURL was released on 1997 and the name was httpget, then urlget and now it is cURL. It uses libcurl library which is threadsafe and available in mot of the popular language like C, PHP, JAVA, Python, etc. I have used curl in one of my script Login with Twitter OAuth API Using PHP

How to install cURL

We already learn that most of the modern web servers already supports cURL and it is enabled by default. If not, then you can also install and enable it in any web servers.

Note: If you are using any shared web server like DreamHost, Bluehost, etc then you can contact to your service provider to enable it.

Now without wasting the time, we will see how to install and enable it in multiple distributions of operating system.

Install cURL on Ubuntu

Once you type curl in your Ubuntu terminal and it says ‘curl command not found’, it means that cURL package is not installed in you Ubuntu.
So this is time to install it in your Ubuntu machine. Simply open the terminal and type the below command:

After completing the installation, you can verify whether it is installed or not by typing the below command in terminal

It is pre-installed in the latest version of Fedora distribution. cURL is inbuilt from fedora 27 onward. If you still want to install curl for the older version of fedora then run the below command as a root user.

Читайте также:  Decimal format for double java

To install php-curl, you can run the below command after login as root.

Verify your curl installation in Fedora

Install curl on OpenSUSE

To install curl in OpenSUSE, please run the below command in the terminal

How to install php-curl

Installing php-curl in PHP 7.0

Install php-curl in PHP 5.6

Install php-curl in PHP 5.5

Now you can verify your installation and check the installed version of curl by running the below command.

How to install CURL in Windows

The installation of curl in windows machine is very simple. You can follow the below steps to enable it.

1. Open your computer C:\ drive and go to C:\wamp\bin\apache\Apache2.2.21\bin directory .

2. Open php.ini file from the above directory.

3. Enable php_curl.dll extension. This can be enabled by removing ‘;’ extension=php_curl.dll

4. After enabling this extension, you need to restart your server.

To check whether CURL is enable or available on your web server or not. Please make a .php file and write the below code and you can easily check from available extensions.

This is a simple method to check whether CURL is enable or not. The another way to check it, Just run phpinfo(); function in your web browser if CURL is enable then a block of CURL will display in your screen and will look like below screenshot:

Advantages of cURL

  1. It supports more protocols like FTP, FTPS, HTTP, HTTPS, SCP, SFTP, etc.
  2. SSL Support: different SSL libraries can call cURL without having any additional effort.
  3. Multipart/form-data can be send using cURL.
  4. cURL also supports gzip compression and Content-Encoding with automatic decompression
  5. The cURL is very compatible with http2
  6. It can handle more chuck of data transfer from one server to another So it can reduce http request timeout problem.
  7. It is more secure than file_get_contents() function.

He is a continuous blogger and has blogged on different topic. He loves to surf Internet and always trying to get new Idea about new Technology and Innovations and sharing these great information to all the technology lovers.

Источник

Русские Блоги

Воспользовавшись своим возрастом, он по-прежнему выполняет студенческий план Alibaba Cloud.Поэтому после покупки серверов Alibaba Cloud в течение нескольких лет естественно создать серверную среду, к которой могут получить доступ другие клиенты.

После установки среды лампы я загрузил веб-страницу в git, чтобы проверить воду, и обнаружил, что браузер предлагает: «Программа не удалась: включите модуль curl»

Читайте также:  Константы ошибок в php

Я не использовал исходный код yum или метод установки в один щелчок для своей лампы. Вместо этого я загрузил исходный код, скомпилировал и установил, и некоторых проблем избежать не удалось. Я искал множество методов в Интернете, и большинство из них были расплывчатыми .

задний план

Установка среды лампы

См. Справочный документ Alibaba Cloud для установки среды лампы:Построение среды лампы Alibaba Cloud。
Что касается версии, при загрузке пакета просто выберите обновленный пакет самостоятельно.

Загрузить тестовую страницу

Артефакт поиска музыки с открытым исходным кодом в git, который необходимо запустить на сервере и написать на php.
Источник:Артефакт поиска музыки,

После выполнения двух вышеуказанных шагов ваш сервер не может запустить загруженную веб-страницу.

Решение

Установить curl

1. rpmПросмотрите изначально установленный curl: rpm -qa | grep curl

2. yumПросмотрите установленный curl: yum list installed | grep curl

Что ж, две искомые данные о завитках абсолютно одинаковы, и время установки слишком рано. В настоящее время curl используется для синтаксического анализа веб-страницы и обнаруживает, что она также может быть проанализирована. Другими словами, Alibaba Cloud устанавливается по умолчанию, и команда может использоваться в обычном режиме, но сама установка не выполняется.phpСоздайте ассоциацию.

Первые два шага в основном бесполезны. Я сам могу это игнорировать.

3. скачатьcurl
ссылка для скачивания:каталог загрузки curl。
Выберите версию, которую хотите загрузить.
Используйте команду: wget https://curl.haxx.se/download/curl-7.64.0.tar.gz Скачать в текущий каталог
Вот я его скачал/usr/local/src/ оглавление,

4. Разархивироватьcurl
Если формат загрузки —tar.gzилиtar.bz2, Используйте команду: tar -zxf curl-7.64.0.tar.gz
Формат загрузки:zipВ конце используйте команду: unzip curl-7.64.0.zip

5. Настроить curl
Предварительное условие: должен быть установлен php и должен быть известен каталог установки php, для настройки требуется php-config.
Введите каталог curl: cd /usr/local/src/curl-7.64.0
Конфигурация: ./configure —prefix=/usr/local/curl —with-php-config=/usr/local/php/bin/php-config

6. Компилировать
После завершения настройки это, вероятно, появится.

Выполните компиляцию: make
После компиляции, пока нет ошибки, в основном нет проблем
после компиляции выглядит следующим образом:

6. установка
Выполнить команду: make install
устанавливается следующим образом:

Убедитесь, что они не появляются
error

7. Добавить переменные среды
команда: export PATH=$PATH:/usr/local/curl/bin
открытьvim /etc/profile Добавьте следующее: export PATH=$PATH:/usr/local/curl/bin

После выполнения этих шагов я только что установил curl (что касается того, почему я не использую настройки Aliyun по умолчанию, я не понимаю его значение по умолчанию), и я не связал PHP с curl.

связанный с PHP curl

1. Войдите в каталог curl в распакованном исходном каталоге php:
команда: cd /usr/local/src/php-7.2.16/ext/curl

Читайте также:  Серверный язык php синтаксис

2. Выполните команду phpize для создания файла конфигурации
Поскольку файл .m4 находится в каталоге curl в текущем каталоге исходного кода php, после выполнения phpize будет сгенерирована серия файлов конфигурации. Это место помнит, что есть введение в git, которое выглядит как curl, и я забыл.
команда: /usr/local/php/bin/phpize

3. Настроить исходный код phpcurl
команда: ./configure —with-curl=/usr/local/curl —with-php-config=/usr/local/php/bin/php-config

4. Компилировать
команда: make
5. установка
команда: make install
После завершения установки в каталоге установки php будет создана папка, в которой находитсяcurl.soфайл
Мой каталог: /usr/local/php/lib/php/extensions/no-debug-zts-20170718/
6. Добавьте в файл конфигурации php.inicurl.so
Откройте файл: vim /etc/php.ini
Добавьте каталоги и файлы:

7. Перезагрузите apache, завершите,

Источник

How To Enable Curl PHP Extension From WHM Root?

cURL (Client URL) is a computer client that allows users to manipulate files from FTP, HTTP, HTTPS, and GOPHER protocols enabled servers. Enabling the Curl PHP extension from WHM root is fairly simple. Let me show you how.

Enable Curl PHP Extension From WHM

  • First of all, log in to your WHM as a root.

WHM AS ROOT

  • Either search for EasyApache and click over the EasyApache 4 or navigate to the Software > EasyApache 4 section.

Search for EasyApache

  • Find the Currently Installed Packages option and click over the Customize button.

Currently Installed Packages Option

  • Wait for the loading process to end and click over the PHP Extensions present inside the Left Corner.

Click over the PHP Extensions

  • Type curl in the search box and turn on whatever PHP versions you want to enable.

Install cURL PHP Version

  • Scroll down to the bottom and hit the Next button.

Save The Changes

  • Wait for the loading process to complete

Wait for the Preperation after clicking over the Next button

  • Review the changes and hit the Provision button from the bottom.

Review the Changes & Click Provision

  • The Provision will be completed in a couple of seconds and the Curl PHP Extension will be installed successfully.

Curl PHP Extension Installed Successfully

That’s it.

You’ve successfully installed the cURL PHP Extension from WHM root. However, there are some other SSH methods to install it via command line by following the below commands:

Install cURL on the Command Line

Ubuntu/Debian Linux Server

CentOS Linux Server

However, if the curl is already installed on your server and also up to date, then you’ll see the message that says “Nothing to do” on your SSH screen because the server already has an updated curl installed in it.

curl already installed command line

That’s how you can install cURL via Command-Line. For more assistance, you can open free chat support on RedserverHost.Com our professionals are always there to help you.

For any other inquiries or updates, you can reach out to us on our Facebook & Twitter handle.

Источник

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