Nickkk
Nickkk

Reputation: 2647

How to update PHP curl extension in Linux/Mac?

What is the easiest way to update the curl extension in PHP? I installed XAMPP on Mac/Linux and noticed that it doesn't allow me to use HTTP2, so I thought of compiling my own curl with the --with-nghttp2 option, but how can I include this into PHP? Installing curl with

brew install curl --with-nghttp2

on Mac doesn't change anything in the phpInfo(), the curl version used by PHP remains the same as before.

Upvotes: 2

Views: 5506

Answers (1)

PK.
PK.

Reputation: 2631

The reasons your phpinfo() doesn't update is because XAMPP's CURL and your terminal default CURL are two different CURLs. homebrew installs/updates your system default curl but not your XAMPP's curl.

you can type which curl in your terminal to check where your system default CURL is located.

Type brew reinstall curl --with-openssl --with-nghttp2 in your terminal to reinstall your curl with openssl and nghttp2. brew is nice because it helps settle the openssl and nghttp2 dependencies.

I didn't dig into it but copying this curl to the xampp library folder and replacing the CURL did not work. what worked was recompiled CURL https://curl.haxx.se/docs/install.html the prefix is your xampp library folder. point your --with-openssl=[homebrew cellar openssl folder] and --with-nghttp2=[homebrew cellar nghttp2 folder]

sorry for the vague answer but if you get the general concept it shouldn't be too hard to figure out the detailed steps.

Upvotes: 1

Related Questions