Jump to content

A newbie SSL / Path question


guyinva

Recommended Posts

Hi Everyone,

 

I have a few pages that are SSL encrypted. When I use the normal http:// protocol, my require_once()'s work fine, but when I switch to https:// they break with:

 

Fatal error: require_once() [function.require]: Failed opening required '/home/user/docroot/dir/folder.php' (include_path='.:') in /home/user/docroot/init.php on line 9

 

Yes, I was too cheap to buy a multi-domain certificate, and this is on a test subdomain, so I get a warning message but the lock indicator appears OK.

 

All my includes/requires are absolute from the OS root (or jail root in my case), so they all look like:

 

include($_SERVER['DOCUMENT_ROOT'] . "/path/to/file.php");

 

I know I'm doing something wrong here, but what part of this equation is breaking my paths? Is it that I'm using absolute paths, or is it that I'm using a certificate not registered to this subdomain.

 

Thanks for your help!

Link to comment
https://forums.phpfreaks.com/topic/103889-a-newbie-ssl-path-question/
Share on other sites

But this is because of the not-validated certificate, right? I can include/require to my hearts content when I run the same page under the authenticated domain.

 

Maybe it's a subdomain issue. My testing site (unauthenticated) is test.mysite.com while the authenticated site is the main mysite.com domain.

Your include()/require() is using the file system. This has nothing to do with SSL, except that your https request appears to resolve to a different DOCUMENT_ROOT folder than your http request and you are apparently trying to include a file that is in a different folder structure than what you expect.

 

Edit: You mention different domains? Don't expect an include/require through the file system to work on a live server where the account permissions are set correctly.

 

If you are actually trying to do an include through a http/https request, that won't include the php code in a file. It will only include any content that is output (the same as if you browsed to the file that is being included.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.