OpenSSL Error Detected – SOLVED
-
Hi there,
I am using Ninja Tables to populate my various tables, by pulling from the respective Google Sheet(s).
I was getting the following error, above my various Ninja Tables throughout my website.Warning: file_get_contents():SSL operation failed with code 1. OpenSSL Error Messages: error0A000126:SSL routines::unexpected eof while reading… /ninja-tables-pro/app/Traits/GoogleSheetTrait.php on line 73
I host with SiteGround, and this is my server info:
PHP Version 8.0.30
SSL Version OpenSSL/3.0.9
cURL Information 7.85.0After digging around, I found the following solution.
I edited my “GoogleSheetTrait.php” file, to reflect the following:- Line 72, I set “allowUrlFopen to “0“
- Line 77, I added “CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0“
This is what my php looks like, from line 61 to line 89
/** * Get remote contents using either file_get_contents or curl. * * @param string $url * * @return string */ private function getRemoteContents($url) { $allowUrlFopen = intval(ini_get('allow_url_fopen')); if ($allowUrlFopen == 0) { return file_get_contents($url); } else { $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); curl_close($ch); return $data; } }
DON’T forget to clear your server Cache!
I hope that this helps anyone having the same issue.
Cheers!
- The topic ‘OpenSSL Error Detected – SOLVED’ is closed to new replies.