I had the same issue. The problem is I am on Ubuntu 22.04 and the latest version of curl is 7.81.0. Curl 7.81.0 and Openssl 3.0.x have a known issue. It is resolved in curl 7.88.1. Unfortunately, you can't update to 7.88.1 through apt. If you are on Ubuntu 22.04 and have curl 7.81.0 and Openssl 3.0.x then I'm fairly certain this is the problem. It's fixable but there are some steps you need to be careful with. This is at your own risk, of course. If you are using Curl 7.81.0 and Openssl 3.0.x and can't update them through a package manager (APT) then here are rough writeup and steps to fix the issue. Change based on your environment as needed:
Ubunt 22.04/curl/openssl 3.0.x issues:
"This error manifests not only with PHP but in a broad variety of contexts, so I write a generic answer here. The other answers address the issue by upgrading software that have implemented the solution already upstream. The reasons and background is explained here. Most software linking OpenSSL have tickets where they introduce support for the new openssl behaviour, e.g. 1, 2, 3. Currently, in Ubuntu 22.04 LTS curl is version 7.81.0, and fails in case of unexpected EOF with OpenSSL 3.0.x. The latest curl is 7.88.1, and apparently resolved the issue, though I could not find the exact commit or ticket. The solution in Ubuntu 22.04 and any system with old curl is to manually compile and install the latest one, as shown for example here.
Importantly, the issue can be addressed on client side, you don't have to do anything with the server (especially that, in most cases, it's a third party server and works correctly)."
sudo apt install equivs
sudo apt remove curl
The following packages will be REMOVED:
curl (take note of any other packages besides curl to reinstall later)
sudo apt purge curl
sudo apt-get update
sudo apt-get install -y libssl-dev autoconf libtool make
cd /usr/local/src
wget https://curl.haxx.se/download/curl-7.88.1.zip
sudo unzip curl-7.88.1.zip
cd curl-7.88.1
sudo ./buildconf
sudo ./configure --with-ssl
sudo make
sudo make install
sudo cp /usr/local/bin/curl /usr/bin/curl
sudo ldconfig
sudo curl -V
cd /home/ubuntu/temp
sudo equivs-control curl
edit curl file to read (ex: sudo nano curl - NOTE: The two important lines are Package and Version):
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: curl
Version: 7.81.0-1ubuntu1.13
Maintainer: Your Name <yourname@example.com>
Architecture: all
Description: <short description; defaults to some wise words>
long description and info
.
second paragraph
equivs-build curl
dpkg -i curl_7.81.0-lubuntu1.13_all.deb
apt install (any packages uninstalled above when you uninstalled curl)