0

I am trying to access a php script from my other site to my new site and I Am getting this error:

Warning: require_once(): SSL operation failed with code 1. OpenSSL Error messages: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in /home/newsite/public_html/abc.php on line 3

Warning: require_once(): Failed to enable crypto in /home/newsite/public_html/abc.php on line 3

Warning: require_once(https://www.example.com/abc/abc.xyz.php): failed to open stream: operation failed in /home/newsite/public_html/abc.php on line 3

Fatal error: require_once(): Failed opening required 'https://www.example.com/abc/abc.xyz.php' (include_path='.:/usr/local/lib/php') in /home/newsite/public_html/abc.php on line 3

I just bought rapid SSL as I thought this was SSL issue and SSL is activated now but I still get same error.

Kasia Gogolek
  • 3,374
  • 4
  • 33
  • 50
newbie756
  • 45
  • 1
  • 2
  • 8
  • You won't be able to modify the SSL settings with `require_once`. You might want to try `curl()` instead. https://stackoverflow.com/questions/3549224/include-require-http-address has a bit more information on that, as well as https://stackoverflow.com/questions/26148701/file-get-contents-ssl-operation-failed-with-code-1-and-more – aynber Feb 28 '18 at 17:10
  • what does abc.xyz.php do? do you just want to output whatever that script returns? – Kasia Gogolek Feb 28 '18 at 17:11
  • @KasiaGogolek yes it reads from DB that I have on example.com and display it here – newbie756 Feb 28 '18 at 17:16
  • @aynber I am not trying to get content from there that php file executes another file that reads and calculates database and passes me response – newbie756 Feb 28 '18 at 17:20
  • Doing `require` or `include` on a remote URL is almost always a very bad idea. Anyone with control over the remote server can easily inject malicious code into your website because the code will be executed as PHP, the same as if it were on your local server. Also, why does the server have an invalid SSL certificate? You can get valid SSL certificates for free with letsencrypt. There's really no excuse to have invalid certificates these days. – Mike Feb 28 '18 at 17:23
  • you want to use ajax then or curl. you shouldn't require_once a non local file. – Kasia Gogolek Feb 28 '18 at 17:23
  • @Mike I just bought brand new SSL so I don't know why you are saying my SSL is not valid – newbie756 Feb 28 '18 at 17:27
  • Can you explain exactly which server has the require_once? Say Server1 is trying to access Server2 to get the data. Is the error message on Server1 or Server2? If it's on Server1, how are you trying to access the data on Server2? If the message is on Server2, you'll have to troubleshoot that particular script. – aynber Feb 28 '18 at 17:27
  • @newbie756 I apologize. I assumed the error was caused by an invalid SSL certificate. See here to try to fix that error: https://stackoverflow.com/questions/14078182/openssl-file-get-contents-failed-to-enable-crypto – Mike Feb 28 '18 at 17:29
  • @aynber I am trying to access server 1 from server 2 this error is on server 2 as I am using php include_once('path') – newbie756 Feb 28 '18 at 17:54
  • Can you show your exact code, please? – aynber Feb 28 '18 at 18:14
  • @aynber This is code from where I am calling server 1 as abc.xyz.php returns html code – newbie756 Feb 28 '18 at 19:00
  • Okay. So as I said before, don't use require_once. It won't handle https properly, and you won't be able to make adjustments. Use `curl` per the first link I posted, or `file_get_contents` per the second link. – aynber Feb 28 '18 at 19:10

0 Answers0