Irate Posted June 9, 2013 Share Posted June 9, 2013 Okay, I have a file on my webhost server (000webhost, if that is important) called HTML.class.php whose only purpose is to print HTML documents automatically, eventually reading out a meta.txt file to print out <meta> tags. So far, so good, that isn't much of a problem, I fixed my syntax and proof-read it, but when I open the file in a browser, I get three warnings and a fatal because include/require (I tried both) failed. Below the output I get (excuse the formating, my mobile won't let me copy things as I want to, so I extracted the source code). <b>Warning</b>: include() [<a href='function.include'>function.include</a>]: open_basedir restriction in effect. File(/sys/important/HTML.class.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in <b>/home/myusername/public_html/test.php</b> on line <b>3</b><br /><br /><b>Warning</b>: include(/sys/important/HTML.class.php) [<a href='function.include'>function.include</a>]: failed to open stream: Operation not permitted in <b>/home/a1632545/public_html/test.php</b> on line <b>3</b><br /><b>Warning</b>: include() [<a href='function.include'>function.include</a>]: Failed opening '/sys/important/HTML.class.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/myusername/public_html/test.php</b> on line <b>3</b><br /><b>Fatal error</b>: Class 'HTML_Create' not found in <b>/home/myusername/public_html/test.php</b> on line <b>5</b>Thanks in advance for your support. Quote Link to comment https://forums.phpfreaks.com/topic/278960-unable-to-includerequire-files/ Share on other sites More sharing options...
davidannis Posted June 9, 2013 Share Posted June 9, 2013 (edited) Looks like your host does not let you include files that are in certain directories (probably those above /home/a1632545/public_html) as a security precaution. That way if I can get a webpage on your server I can't do things like include '/etc/passwd' ; If you move the files you want to include to a directory like /home/a1632545/public_html/includes it should fix the problem. Edited June 9, 2013 by davidannis Quote Link to comment https://forums.phpfreaks.com/topic/278960-unable-to-includerequire-files/#findComment-1434986 Share on other sites More sharing options...
DavidAM Posted June 9, 2013 Share Posted June 9, 2013 File(/sys/important/HTML.class.php) is not within the allowed path(s):When you put a slash at the beginning of a filepath, it points to the root of the SYSTEM. You need to specify where that file is: /home/myusername/public_html/test.phpSo the include should be something like this: include('/home/myusername/public_html/sys/important/HTML.class.php if it is in the public path. Quote Link to comment https://forums.phpfreaks.com/topic/278960-unable-to-includerequire-files/#findComment-1434990 Share on other sites More sharing options...
Irate Posted June 9, 2013 Author Share Posted June 9, 2013 I feel stupid now, I moved the files to my public_html dir but didn't change the include path in test.php ._. Thanks for your help! ^^ Quote Link to comment https://forums.phpfreaks.com/topic/278960-unable-to-includerequire-files/#findComment-1434996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.