Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get curl working on win 10 , wamp php 7.2?

Tags:

php

curl

wamp

I tried everything I could find like instructions here How to get CURL to work with PHP on Windows? (WAMP)

to copy dll files from php7.2.0 folder to apache2.4.18\ bin folder

my setup

win 10 64
wamp 3.1.1 
php, 5.6.28, 7.0.4, 7.2
apache 2.4.18 

curl works on any other php version but not on 7.2

cheeked extension_dir path and it points to right dir

extension_dir ="T:/wamp64/bin/php/php7.2.0/ext/" 

loaded php 7.2 extensions

extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
extension=fileinfo
;extension=ftp
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
;extension=interbase
extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=phpdbg_webhelper
;extension=shmop

now I see that in 7.0.4 there was php_ prefix and dll suffix

extension=php_curl.dll

but this is in the 7.2 info

; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
;   extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - ODBC support is built in, so no dll is needed for it.
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.

someone else had the same issue but there was no solution http://forum.wampserver.com/read.php?2,149346,149609#REPLY

like image 843
Benn Avatar asked Dec 22 '17 15:12

Benn


People also ask

How do I know if cURL is enabled in PHP?

Create phpinfo. php file and save. phpinfo; ?> Then go to http://domainname/phpinfo.php to check whether CURL is enabled or not.

Is cURL included in PHP?

cURL is a PHP library and command-line tool (similar to wget) that allows you to send and receive files over HTTP and FTP. You can use proxies, pass data over SSL connections, set cookies, and even get files that are protected by a login.


2 Answers

Solution that worked for me

Install Apache 2.4.29,

for some reason 2.4.18 was not loading php 7.2 curl

like image 83
Benn Avatar answered Sep 19 '22 12:09

Benn


Hope this will help someone. I spent 4 hours finding a solution for this problem and nothing I found was effective. So what I did was (Windows 10 x64 + Apache 2.4.29):

  1. I downloaded php 7.2 for windows from the PECL and uncommented and changed the ;extension=curl to extension=php_curl.dll
  2. Copied the libssh2.dll from the php folder to the Apache24/bin folder.

And it worked!!!

Of course changed the Windows PATH variable pointing to the old php version folder to the new folder. I read some comments that it's not a good idea of copy and paste the file but this was the only option which worked for me.

like image 33
Rumen Tabakov Avatar answered Sep 20 '22 12:09

Rumen Tabakov