Install curl in php windows

I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/

to install & config apache
get the PHP5 packages
and get the CURL packages.

I run the apache and run a PHP script. no problem.
but when I run the php script with curl, it fails.

It returns: **Call to undefined function curl_version() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testing.php on line 5**

In which line 5 is a called to curl_init()

I output the php -i to see whether the right path to extension is called. It is correctly set:

extension_dir => C:\PHP\ext => C:\PHP\ext
cURL support => enabled
cURL Information => libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3

I even tried to run curl_version() but still, same kind of error comes up.
It looks like the PHP can’t find the CURL extension, but the php.ini (and also php -i) shows that it is set.

any idea? :)

P.S>  System I m running on:
Windows XP
Apache 2.2
PHP 5.2.6
CURL Win32 Generic Binaries: Win32 2000/XP  metalink    7.19.0  binary  SSL enabled     Daniel Stenberg     249 KB

I didn’t get this:

Win32 2000/XP   7.19.0  libcurl     SSL enabled     Günter Knauf    1.55 MB
Should I get this one instead?

The reason I need to use CURL is that it is the requirement from my project. So, I can only stick with that.
XAMPP… how does it work in Windows? Is there any site that you can recommend? Thanks.

I have tried a lot of things on installing cURL and check everything, but still, I’m stilling circling around the problem and have no idea what’s going on.

The Apache server uses the right PHP.ini. and the PHP.ini has the correct extension_dir and extension=php_curl.dll
I have no idea why it doesn’t work. even I follow every step for setting it up. :(

Установка

Для использования 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.

comments at adstation-systems dot com

15 years ago

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 might also find the information at http://curl.phptrack.com/forum/viewtopic.php?t=52 useful.

Joseph Marlin

12 years ago

Ubuntu 11.04

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.

Developtus.com

8 years ago

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

epos_jk

5 years ago

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)

epos_jk

5 years ago

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)

TristanV

9 years ago

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 :)

jorijnsmit at gmail dot com

9 years ago

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

regs at voidship dot net

15 years ago

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.

NV

1 year ago

If trying to get installed on Windows (I was using Windows 10, Apache 2.4, PHP 8.1) and the curl module isn't loading and PHP is showing/logging the following error but <phpPath>\ext\php_curl.dll does exist:

[14-Apr-2022 23:41:36 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: <phpPath>\ext\curl (The specified module could not be found), <phpPath>\ext\php_curl.dll (The specified module could not be found)) in Unknown on line 0

The problem is not that it can't find the module but that it can't find its dependencies (ie <phpPath>\libcrypto-1.1.dll and libssl-1.1.dll or similar). As described in other comments, you need to add <phpPath> to the Systerm Variables, PATH variable.

But, if you are starting Apache as a service, the default is for the service to run under the Local System account. In that case, ****YOU NEED TO REBOOT**** for the change in the PATH variable to be updated for the Local System account (see the following for reference:
https://stackoverflow.com/questions/32068893/how-to-change-path-value-for-local-system-account-in-ms-windows)

anonymous

5 years ago

Upgrading to php 7.1.6 on Apache 2.4 32bit version Windows 7 x64

this curl implementation works:

1. C:/(path to php folder)/php.ini
enable extension=php_curl.dll

libeay32.dll, ssleay32.dll, libssh2.dll find directly in php7 folder

2. add this to Apache/conf/httpd.conf
# load curl and open ssl libraries
LoadFile "C:/(path to php folder)/libeay32.dll"
LoadFile "C:/(path to php folder)/ssleay32.dll"
LoadFile "C:/(path to php folder)/libssh2.dll"

Greg

3 years ago

For those who may be having WordPress issues relating to curl, the answer for me was that the curl.cainfo wasn't specified in the config. This resulted in a plugin giving some non-graceful errors for which I was finally able to track it down.

curl.cainfo = "C:\php\extras\ssl\cacert.pem"

You'll need a copy of the cacert.pem (doesn't come with PHP and does need to be updated every so often can be found at an official permalink of:
https://curl.haxx.se/ca/cacert.pem

They use a modified version of Mozilla's certificate store meant to work with libcurl.

I'm not an expert, this is just what fixed the errors for me.

(cacert.pem lists official root certificate providers so your computer knows which ones its safe to authenticate against is my lay interpretation. I'm sure it's not technically accurate but close enough for us lay people.)

wixelbomb at yahoo dot com

13 years ago

Just an additional note for Windows XP installations ...

The instructions others have courteously given still lack one small item for those who have the Windows/system32 directory as the repository for the .dll files concerned with php_curl.

Go to the ext directory of your php installation and copy php_curl.dll to the Windows/system32 folder after you have followed the advise given elsewhere.

So ...
1) remove ';' from extension=php_curl.dll in php.ini
2) ensure that ssleay32.dll and libeay32.dll are in Windows/system32.
3) Copy php_curl.dll into Windows\System32 as well.

G'day

bearstate

1004707812 at qq dot com

5 years ago

Win10 64bit, php7 x64,apache x64
It's important to set " extension_dir = "X:/WAMP/php/ext" " clearly in php.ini .
Remember some names of dll has changed recently, specially in the x64 environment.

karliskavacis at gmail dot com

7 years ago

In my case, while running Windows 10 and Apache Httpd 2.4, I had to add my PHP7 root directory to Windows PATH and it resolved issues with failing to load couple of PHP extensions.

Windows+

3 years ago

if you cant solve this "Fatal error: Uncaught Error: Call to undefined function curl_init()" on WINDOWS

Try add to this strings to apache config (httpd.conf):

LoadFile "C:\Program Files\Apache\php\libssh2.dll"
LoadFile "C:\Program Files\Apache\php\libcrypto-1_1-x64.dll"
LoadFile "C:\Program Files\Apache\php\libssl-1_1-x64.dll"

and restart apache (dont forget to use your php folder name);

Moving this files to apache or windows folder, dont work for me:

libeay32.dll (libcrypto-*.dll)
libssh2.dll
ssleay32.dll (libssl-*.dll)

cristianods at yahoo dot com

15 years ago

Tip for Installing cURL with AppServ development server on Windows

If you are running AppServ as a WAMP development environment on a Windows machine, you may experience difficulty installing cURL. Here are some helpful steps:

First go to the PHP directory and copy the following libraries to the windows/system32 dir.

ssleay32.dll

libeay32.dll

Open the php ini file and remove the ; from extension=php_curl.dll

Reboot your machine to load […]

lymer at ca dot ibm dot com

8 years ago

For Windows 7 (64 bit), ensure you not only enable the curl extension (i.e. uncomment "extension=php_curl.dll" in php.ini) as described in this manual, but also set the extension directory for Windows (e.g. extension_dir = "ext") in the php.ini file. Adding / copying dll files or changing the system path were not necessary. (Versions used: Apache 2.4.1 (Win64) and PHP 5.5.15.)

sharif dot golang at gmail dot com

2 years ago

I tried with that and it's properly works.

jmichieli76 at yahoo dot ca

11 years ago

It should be noted that on a standard installation of php 5.2.17 on windows has this functionality installed and enabled by default.

dave at omgomg dot co dot uk

3 years ago

To get curl working on win64 with apache 2.4 and php 7.4 i had to add to the path
C:\Apache24\bin\
C:\php\

Tovster

4 years ago

I had curl not working in Windows with Apache 2.4 and PHP 7.3 - Strangly phpinfo showed author but not curl section/panel.

I changed the widows path to include the PHP directory and after a reboot it started working.

You can change the windows path in Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables then edit the path variable in "System Variables"

I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/

to install & config apache
get the PHP5 packages
and get the CURL packages.

I run the apache and run a PHP script. no problem.
but when I run the php script with curl, it fails.

It returns: **Call to undefined function curl_version() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\testing.php on line 5**

In which line 5 is a called to curl_init()

I output the php -i to see whether the right path to extension is called. It is correctly set:

extension_dir => C:\PHP\ext => C:\PHP\ext
cURL support => enabled
cURL Information => libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3

I even tried to run curl_version() but still, same kind of error comes up.
It looks like the PHP can’t find the CURL extension, but the php.ini (and also php -i) shows that it is set.

any idea? :)

P.S>  System I m running on:
Windows XP
Apache 2.2
PHP 5.2.6
CURL Win32 Generic Binaries: Win32 2000/XP  metalink    7.19.0  binary  SSL enabled     Daniel Stenberg     249 KB

I didn’t get this:

Win32 2000/XP   7.19.0  libcurl     SSL enabled     Günter Knauf    1.55 MB
Should I get this one instead?

The reason I need to use CURL is that it is the requirement from my project. So, I can only stick with that.
XAMPP… how does it work in Windows? Is there any site that you can recommend? Thanks.

I have tried a lot of things on installing cURL and check everything, but still, I’m stilling circling around the problem and have no idea what’s going on.

The Apache server uses the right PHP.ini. and the PHP.ini has the correct extension_dir and extension=php_curl.dll
I have no idea why it doesn’t work. even I follow every step for setting it up. :(

12.07.2015

Краткая инструкция для тех, кто хочет настроить curl php на Windows 8.1 x64. Если curl не настроен на вашем вэб-сервере, то возникает следующая ошибка: Fatal error: Call to undefined function curl_init().

Настройка cURL

Написанное ниже актуально для связки Windows 8.1 x64,  Windows10 x64 + Apache 2.4.12 (win32) + Open SSl 1.0.1m + PHP 5.6.11 (php-5.6.11-Win32-VC11-x86).

  1. Скачиваем библиотеку cURL http://winampplugins.co.uk/curl. Распаковываем в любую папку. Например, «W:\WebServers\usr\local\curl».
  2. В файле настроек PHP php.ini необходимо включить расширение extension=php_curl.dll.
  3. Пункт не обязательный, но во многих источниках его рекомендуют выполнять. У нас работает без выполнения этого пункта. Из папки где установлен PHP скопировать в папку «C:\Windows\system32» следующие библиотеки: libssh2.dll, php_curl.dll (находится в папке ext), ssleay32.dll, libeay32.dll. Дополнительно файл ssleay32.dll необходимо скопировать в «C:\Windows\SysWOW64». 
  4. Добавить в переменные среды в переменную Path пути до папки установки curl.exe и файла php.ini. Например, «W:\WebServers\usr\local\curl;W:\WebServers\usr\local\php5». Очень порадовало то, что в windows10 (1511) появился новый интерфейс редактирования переменных сред. Стало очень удобно редактировать параметры.

Включение поддержки SSL для cURL

  1. Скачать файл http://curl.haxx.se/ca/cacert.pem в папку, в которой установлена библиотека curl.exe.
  2. Переименовать скаченный файл в curl-ca-bundle.crt
  3. Перезагрузить компьютер.

Проверка работы cURL

Запустите командную строку Windows. Выполните следующую команду:

curl https://www.google.com или curl http://filinkov.ru

cURL is a popular tool for making HTTP requests from the command line. It is also available as a library for programming languages, including PHP.

The cURL extension in PHP allows you to make HTTP requests directly from your PHP scripts, making it an essential tool for developers.

In this tutorial, we will show you how to install the cURL extension for PHP 7 on different operating systems such as Windows, Linux, and macOS.


Prerequisites

Before we begin, you need to make sure that you have PHP 7 installed on your machine.

You can check the version of PHP installed on your machine by running the following command in the terminal:

If you do not have PHP 7 installed, you can download it from the official website of PHP (https://windows.php.net/download/).

Installing cURL Extension on Windows

On Windows, the cURL extension is not enabled by default.

To install the cURL extension, you need to follow these steps:

  1. Download the latest version of the cURL extension for PHP 7 from the official website of cURL (https://windows.php.net/downloads/pecl/releases/curl/).
  2. Extract the downloaded file to a directory of your choice.
  3. Open the Command Prompt with administrative privileges and navigate to the directory where you have extracted the cURL extension.
  4. Run the following command to install the cURL extension:
php.exe -d extension_dir=C:\php\ext -d extension=php_curl.dll -n -q -d max_execution_time=0 -d memory_limit=-1 -f pecl\install-pecl-curl.php install
  1. Once the installation is complete, you need to add the following line to your PHP configuration file (php.ini) to enable the cURL extension:
  1. Restart your web server to apply the changes.
  2. Verify that the cURL extension is installed by running the following command:

If the cURL extension is installed, you will see the following output:

Installing cURL Extension on Linux

On Linux, the cURL extension is usually installed by default.

However, if it is not installed, you can install it by following these steps:

  1. Open the terminal and run the following command to install the cURL extension:
sudo apt-get install php7.0-curl
  1. Once the installation is complete, you need to restart your web server to apply the changes.
  2. Verify that the cURL extension is installed by running the following command:

If the cURL extension is installed, you will see the following output:

Installing cURL Extension on macOS

On macOS, the cURL extension is usually installed by default. However, if it is not installed, you can install it by following these steps:

  • Open the terminal and run the following command to install the cURL extension:
  • Once the installation is complete, you need to add the following line to your PHP configuration file (php.ini) to enable the cURL extension:
  • Restart your web server to apply the changes.
  • Verify that the cURL extension is installed by running the following command:

If the cURL extension is installed, you will see the following output:


Conclusion

In this tutorial, we have shown you how to install the cURL extension for PHP 7 on different operating systems such as Windows, Linux, and macOS.

The cURL extension is a powerful tool that allows you to make HTTP requests directly from your PHP scripts, making it an essential tool for developers.

With the cURL extension, you can easily perform tasks such as sending HTTP requests, retrieving data from APIs, and more.

  • Install apache php for windows
  • Install android adb windows 10
  • Insatiable boot device windows 10
  • Instagram skachat dlya kompyuter windows 10 pro
  • Inputmapper скачать для windows 10