0

I'm trying to get a simple PHP cURL request to a REST API to work, but I'm getting this error no matter what I try:

error:14077410:SSL routines:func(119):reason(1040)

My PHP code is:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://jsonplaceholder.typicode.com/users");
curl_setopt($ch, CURLOPT_FAILONERROR, true);
$response = curl_exec($ch);
echo $response;
if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
    echo $error_msg;
}
curl_close($ch);

This works just fine on other servers, such as here on tehplayground.com

Here is some info from phpinfo() on my server:

PHP Version 5.3.6

cURL support    enabled
cURL Information    7.12.1
Age 2
Features
AsynchDNS   No
Debug   No
GSS-Negotiate   Yes
IDN Yes
IPv6    Yes
Largefile   Yes
NTLM    Yes
SPNEGO  No
SSL Yes
krb4    No
libz    Yes
Protocols   ftp, gopher, telnet, dict, ldap, http, file, https, ftps
Host    i386-redhat-linux-gnu
SSL Version OpenSSL/0.9.7a
ZLib Version    1.2.1.2

Any idea what's wrong? (I cannot change the server I'm using.)

synaptik
  • 8,971
  • 16
  • 71
  • 98
  • You really should not be using PHP version 5.3 . Upgrade. ***NOW*** – Martin Mar 24 '20 at 15:30
  • Also you really ***REALLY*** should be updating your OpenSSL version. That version is majorly out of date. – Martin Mar 24 '20 at 15:31
  • Edit your question and show us [**What your PHP error log tells you**](https://stackoverflow.com/questions/5127838/where-does-php-store-the-error-log-php5-apache-fastcgi-cpanel)? – Martin Mar 24 '20 at 15:32
  • @Martin Yes. Unfortunately I have no control over this. Internal DMZ servers. Will try to obtain error log like you suggest... – synaptik Mar 24 '20 at 15:35
  • And cURL 7.12 is **fifteen years old**. All of the software you are reporting is majorly out of date. If you can't fix this then you really should be looking at dumping this server and using one that's maybe only 10 years old..... (hah) . `:-/` – Martin Mar 24 '20 at 15:37
  • Your tech playgound link uses PHP 7.2 and works fine. So, try upgrading your PHP and seeing how that improves your life. – Martin Mar 24 '20 at 15:38
  • Also try [this link](https://stackoverflow.com/questions/33317674/ssl-connect-error-in-curl-and-php-5-3-3)? – Martin Mar 24 '20 at 15:38
  • @Martin installing webserver on another machine. Will update this question afterwards. – synaptik Mar 24 '20 at 15:49

0 Answers0