I am currently working on a project which makes an ajax call to my API on the same server. All went good and fine till a few hours ago when cURL suddenly stopped working without any reason and it’s giving me following error
Protocol https not supported or disabled in libcurl
But it doesn’t make any sense because it worked earlier and the only thing I changed was something in the login-screen (only PHP) and the timezone on the server from default to “Europe/Berlin” with
dpkg-reconfigure tzdata [php.ini] date.timezone = "Europe/Berlin";
I’ve already restarted apache2, rebooted the server, checked the php.ini file and my phpinfo, it’s all the same without any errors or changes, but curl just won’t work. I tried to curl other hosts & localhost but nothing works. I also checked /var/mail/root, there aren’t any errors.
Few information to my server
- Debian 8
- SSL certificate by Symantec
- full-root-access without any restrictions
That’s the cURL-Code I am using
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, count($params)); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); session_write_close(); $result = curl_exec($ch); curl_close($ch); session_start();
Like I said it worked fine and without any problems for longer than 1 month. That’s the weirdest thing I’ve ever seen. I hope somebody can help me. If not, are there any good alternatives to curl? (POST-Requests)
Thanks in advance!
Advertisement
Answer
Thanks to all for your help but I found the error. The problem was the following:
curl
didn’t worked with https protocol, because there was a broken link/file in the libraries folder. If curl isn’t working for you, check with curl --version
if you get the following error:
curl: /usr/local/lib/libcurl.so.4: no version information available (required by curl)
If yes, go to /usr/local/lib
and delete both libcurl
links/files. This solved the problem for me. After that just restart apache2 and it should work again.
Note that this only solved the problem for me and it’s not a global solving problem. So be aware of what you delete on your server. Always make a backup!