I'm starting with this error:
Call to undefined function curl_init()
Fine, so I go to PHP's php.ini
file and uncomment:
;extension=curl
to extension=curl
I restart Apache, and?
Call to undefined function curl_init()
I added the full PHP directory to the system paths, and?
Call to undefined function curl_init()
So I check phpinfo()
and I see the module is loaded for cURL but no other string instances mentioned:
PHP's get_loaded_extensions()
does not list cURL.
So I figure, I might as well install a fresh version of cURL.
So the main cURL page doesn't have binaries for Windows of course. So I eventually find my way to https://curl.se/download.html#Win64. Now I've gone through their documentation and they don't have anything about installing the binaries but they have information about building them. Which is like having a guy give you a spare inflated tire but not the tools to install it but he wants to tell you where to get the spare next time, not helpful.
So I've got a ZIP file with cURL and the readme file has no installation instructions. None of the documentation from what I can see clarifies what to do with the files.
- Do I simply drag-and-drop the files to the php\ext folder? It contains a
libcurl-x64.dll
file, I guess I can either rename it to simplylibcurl.dll
or add a custom extension entry inphp.ini
but I'm not sure and I can't find documentation specific to that. - Do I have to add a custom entry for my
php.ini
file?
How do I install (the binary version of) cURL for PHP on Windows?
- Running PHP 8.3 on Windows 10 x64.
php.ini
path is set:extension_dir = "C:\PHP\ext\"
.- PHP cURL's author's name appears in
phpinfo()
however not the cURL header like on my live LAMP server. - Running
php.exe
from the command line does not return error messages.
Edit 1
I checked the Apache error log and found this:
PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: C:\PHP\ext\curl (The specified module could not be found), C:\PHP\ext\php_curl.dll (The specified module could not be found)) in Unknown on line 0
I have the extension absolutely defined (extension=C:\PHP\ext\php_curl.dll
) and still got this error.
Edit 2
I came across a tutorial to run the following from the command line:
deplister.exe ext\php_curl.dll
It produced the following list:
- php8ts.dll,OK
- libcrypto-3-x64.dll,OK
- libssl-3-x64.dll,OK
- CRYPT32.dll,OK
- WLDAP32.dll,OK
- Normaliz.dll,OK
- libssh2.dll,OK
- nghttp2.dll,OK
- KERNEL32.dll,OK
- ADVAPI32.dll,OK
- WS2_32.dll,OK
- bcrypt.dll,OK
- VCRUNTIME140.dll,OK
- api-ms-win-crt-heap-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-stdio-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-string-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-runtime-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-convert-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-filesystem-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-utility-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-time-l1-1-0.dll,NOTFOUND
- api-ms-win-crt-math-l1-1-0.dll,NOTFOUND
So clearly some version of Visual C++ is missing. I'll post another follow-up soon.
php -i | find ".ini"