Apache php install curl

Cannot enable php-curl on Ubuntu 18.04 & PHP 7.2

So right now, i am attempting to enable php-curl within my apache2 server on Ubuntu 18.04 to allow an iframe to display an external site page. i have been using methods to attempt this that i have found documented in several places: StackOverflow: How do I install the ext-curl extension with PHP 7? StackOverflow: install cURL in php 7 (ubuntu14.04) LinuxConfig.org: How to enable and disable PHP curl module with Apache on Ubuntu Linux No matter what i seem to do, i cannot get anything sort of curl-related commands to work within php, which is very frustrating. i have ensured that i have used sudo apt-get install curl php7.2-curl which installed without issue, and have then restarted the apache service using sudo service apache2 restart . I have tried to enable the extension in the php.ini using extension=php_curl.dll , and also extension=curl , with no luck. If i try the code given on linuxconfig.org to check the curl module state, it says its disabled. If i try running my php code, i find in my logs:

PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in /var/www/html/inc.redirect.php:4\nStack trace:\n#0 \n thrown in /var/www/html/inc.redirect.php on line 4

What am i doing wrong/missing? UPDATE: looking in the apache2 error.log when i restart the service, i see the following:

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/20160303/curl.so’ — /usr/lib/php/20160303/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0

Still attempting to dig more into this, and it appears that the curl.so file its looking for is located in ‘/usr/lib/php/20170718’. What do i have to do to change the php config to look in the proper directory?

Читайте также:  Php get ini path

Источник

Apache php install curl

Для использования cURL необходимо собрать PHP с опцией —with-curl[=DIR], где DIR — имя каталога, содержащего подкаталоги lib и include . Каталог include должен содержать подкаталог curl с файлами easy.h и curl.h . В каталоге lib должен быть файл libcurl.a .

Замечание: Замечание для пользователей Win32
Для работы с этим модулем в Windows файлы libeay32.dll и ssleay32.dll , либо, начиная с OpenSSL 1.1, libcrypto-*.dll и libssl-*.dll , должны существовать в системной переменной окружения PATH . Также libssh2.dll должен присутствовать в вашей переменной окружения PATH . Вам не требуется файл libcurl.dll с сайта cURL.

User Contributed Notes 21 notes

I already had Apache and PHP5 setup, but simply adding php5-curl and curl did *not* work. I also had to get libcurl3 and libcurl3-dev. The full command:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

You’ll know if it works because phpinfo() will get a new section with Curl info.

Upgrading to php 5.6.9 on Windows 7 x64 curl no longer is recognised. No errors on server start package just not available and didn’t show in phpinfo.php. deplister.exe was ok
I fixed coping the following list files from php folder (in my case D:\xampp\php)
libeay32.dll
libssh2.dll
ssleay32.dll
to c:\xampp\apache\bin (or your apache\bin path), restart apache and works fine, apache’s libraries were outdated

Beginning with version 1.1.0 OpenSSL did change their libary names!
libeay32.dll is now libcrypto-*.dll (e.g. libcrypto-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows)
ssleay32.dll is now libssl-*.dll (e.g. libssl-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows)

You may be confused, as I was, by the instructions for installing cURL in php. The instruction «To use PHP’s cURL support you must also compile PHP —with-curl[=DIR]. » was murky to me, since I didn’t compile php when I installed it. I just copied all of the necessary files to the correct folders as described very clearly in the php manual.

I am using Windows XP and Apache with php 5.1.6. In this situation, and it may apply to php versions of 5.0 and later, all one needs to do is remove the «;» from the front of the directive extension=php_curl.dll. You should also check to make certain that libeay32.dll and ssleay32.dll are in your php directory with the other dll’s. This directory should already be in you path, so the instruction to put them in you path is not critical.

You can then run phpinfo() and you should see a heading for curl in the listing.

Succinctly, my installation of cURL consisted of removing the semi-colon in front of the ;extension=php_curl.dll line in php.ini, saving php.ini and restarting Apache. You may wish to try this if you are using php 5.0 and later and are having difficulty understanding the instructions on the cURL installation page at php.net

You dont need to copy files to use PHP CURL with Apache 2.4 — use the LoadFile directive in your apache config file instead:
LoadFile «C:/php7/libssh2.dll»
(that was all it took for me to get it work)

If you’re dense like I am, spare yourself the trouble on an Ubuntu system (probably Debian too) and.

$ sudo apt-get install php5-curl

Then feel dumb, but not as dumb as me.

If you are running on Windows with a Wampserver or alike preconfigured PHP, if you did everything that was advised (path is correct, dlls are in the System32 or the Wow64 folder, php_curl extension uncommented in the php.ini, rebooted your machine and restarted your services), and you still receive messages saying that curl is not installed :
— maybe you are running a command line script (and not a curl instruction within a web application). If yes, remember that there are 2 distinct php.ini configuration files : one for the php-cli commands (run php at command line) and one for the php instructions (run from a page in your www folder).
Wampserver’s menuitem «php.ini» only opens the webserver’s php.ini, not the php-cli one.
So it will be great to check your php-cli’s php.ini configuration file ! (you’ll find it in the php.exe’s installation folder)
You need to uncomment the extension php_curl in this php.ini file for the command lines to work with curl.
Also uncomment the php_openssl extention by the way (often used with curl).
I hope this fixed issue will help someone else 🙂

It is not necessary to always (re)compile PHP. For me it was sufficient to install php5-curl and restart Apache:

$ sudo apt-get install php5-curl
$ sudo /etc/init.d/apache2 restart

Источник

How do I install curl in php5?

I currently have PHP 5.3 installed with Apache in 10.04 Lucid. How can I add the PHP Curl libraries? Do I need to install any other dependencies for curl?

7 Answers 7

I believe that the package php5-curl should do the trick. Use the package manager of your choice and the deps should be taken care of.

sudo apt-get install php5-curl 

You will need to restart the server afterwards:

sudo service apache2 restart 

Alternatively, if you are using php-fpm, you’ll need to restart php5-fpm instead

sudo service php5-fpm restart 

It’s perfectly fine asking here, but next time make sure to search the Software Center to save you some time 😉

@xav0989, it seems like this is a bug upstream, as on Debian it only reloads apache’s config. It should restart apache.

For the subversion php5.6 use the following command (tested for Ubuntu 14.04):

sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get upgrade sudo apt-get install php5.6 php — version sudo apt-get install php5.6-curl 

My conf: Ubuntu 11.10, already installed mysql,php5 and apache2, before installing php5-curl in terminal I did:

sudo -H gedit /etc/apt/sources.list 

you can check your configuration in http://repogen.simplylinux.ch/

aptitude install php5-curl 

You get something like this:

The following NEW packages will be installed: php5-curl 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 27.1 kB of archives. After unpacking 127 kB will be used. The following packages have unmet dependencies: php5-curl: Depends: php5-common (= 5.3.6-13ubuntu3.1) but 5.3.6-13ubuntu3.8 is installed. The following actions will resolve these dependencies: Keep the following packages at their current version: 1) php5-curl [Not Installed] Accept this solution? [Y/n/q/?] n 

Your answer here is n

The following actions will resolve these dependencies: Downgrade the following packages: 1) libapache2-mod-php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] 2) php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] 3) php5-cli [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] 4) php5-common [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] 5) php5-gd [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] 6) php5-mysql [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)] Accept this solution? [Y/n/q/?] y 

Your answer here is y.

In your browser open phpinfo(), check property:

extension_dir /usr/lib/php5/20090626+lfs 

In that folder you should now have curl.so

nano /etc/php5/apache2/php.ini 

find «dynamic extensions» add code below:

After that restart apache2 and check phpinfo(), curl must be enabled

Источник

Установка cURL на связку apache, php

Всем привет) Установил связку php 5.6.8 и apache 2.4 Пытаюсь установить cURL, раскоментировал в php.ini строчку php_curl.dll. Сделал индекс файл с phpinfo(), модуль появляется. Захожу в командную строку с правами админа, проверяю версию curl, но cmd выдает ошибку, что команды curl не существует. В пeременную среды path добавлял c:/php и с:/php/ext, может нужно еще что-то связанное с curl в path добавить? Подскажите, как из cmd работать с curl?

Как настроить связку PHP +APACHE на WINDOWS
Как настроить связку PHP +APACHE на WINDOWS

не получается установить связку apache+mysql+php+phpMyAdmin
Доброго времени суток! Решил попробовать установить эту связку по методу.

PHP curl Apache Ubuntu — ошибка 500
Здравствуйте! Поставил Ubuntu 14.04, установил apache + php5 Запустил апач — тестовую страницу.

Установка Apache + PHP
Прочитал хелп, но так и не понял что и как. При установке PHP 5.3.5 не выдается сообщение с.

Эксперт PHP

Команда php -r print_r(curl_version()); вернула дынные о версии curl и openssl. Версия curl 7.4.0 openssl/1.0.1m
Значит модуль подключен, но как его из cmd использовать?

ЦитатаСообщение от Maksimus1991 Посмотреть сообщение

Всем привет) Установил связку php 5.6.8 и apache 2.4 Пытаюсь установить cURL, раскоментировал в php.ini строчку php_curl.dll. Сделал индекс файл с phpinfo(), модуль появляется. Захожу в командную строку с правами админа, проверяю версию curl, но cmd выдает ошибку, что команды curl не существует. В пeременную среды path добавлял c:/php и с:/php/ext, может нужно еще что-то связанное с curl в path добавить? Подскажите, как из cmd работать с curl?

Вы путаете модуль curl в php и отдельную программу curl.

То что Вы установили и настроили — это расширение для php. Пользоваться им можно только в php коде.

То, что Вы хотите запускать из cmd это программа curl, которая вообще никакого отношения ни к php ни к apache не имеет. Ссылка с википедии, там же есть ссылка на официальный сайт — https://ru.wikipedia.org/wiki/CURL

Установка php + apache + mysq
как мне установить php + apache + mysql, стандартно для новичка

Установка apache php mysql
Здравствуйте. Изучил досконально https://www.cyberforum.ru/apache/thread83339.html И что-то не.

установка apache и PHP на Windows 8
Добрый день! подскажите как установить apache и PHP на Windows 8 ?

Установка php+apache+mysql
Всем привет, хочу установить пакет программ сабж. Так вот, я нашел тему где все расписано (на это.

Источник

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