FreeHostia Forums
https://forum.freehostia.com/

PHP cannot include file outside domain root folder
https://forum.freehostia.com/viewtopic.php?f=7&t=66091
Page 1 of 1

Author:  andy35 [ Mon Jun 15, 2020 8:09 pm ]
Post subject:  PHP cannot include file outside domain root folder

I use php and mysql. Many books and guides advise put sensitive information like database password and user name in separate file located outside of domain root folder, actually above this folder, one level higher. So, php script could access this files using command include ('../connect_info.php');, but hackers could not access this file via http request. This method works perfect with other web hosting providers. But when I use freehostia, php even cannot see files outside domain root folder. This method works if I put both files (main and included) in the same folder, however this is not good for security. I think this is because freehostia settings do not allow at all php to access files outside domain root folder. I can upload the file connect_info.php above domain root folder using FTP, but php cannot access this file. Please advise how can I access files located one level higher than my domain root folder using php include command - include ('../connect_info.php');

Author:  Jace Cohen [ Tue Jun 16, 2020 4:53 am ]
Post subject:  Re: PHP cannot include file outside domain root folder

Hello,

This is because of a Jail Host option which prevents scripts from accessing files outside of their current directory. It can be disabled at the Hosted Domains section of the control panel.

In the future, if you are experiencing any issues or if you have any questions, please open a ticket from the control panel of your hosting account to the corresponding department so that we can properly assist you. You can open a ticket by hovering the mouse button over the Help Center button and selecting My Tickets.

Best Regards,
Jace Cohen

Author:  andy35 [ Tue Jun 16, 2020 4:52 pm ]
Post subject:  Re: PHP cannot include file outside domain root folder

It works now! Thank you so much for your help and advise.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/