FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


[php] including from lib folder impossible





jasperlevink
Hello folks.
I'm trying to include a file from the lib folder. But I get an error:

the code:

if(!require("/home/httpd/vhosts/mydomain.be/lib/inc/myclass.class.php")) die("ERROR 1 - Failed loading class");

the error:

Warning: main(): open_basedir restriction in effect. File(/home/httpd/vhosts/mydomain.be/lib/inc/myclass.class.php) is not within the allowed path(s): (/home/httpd/vhosts/mydomain.be/httpsdocs:/tmp) in /home/httpd/vhosts/mydomain.be/httpsdocs/page.php on line 4

Why is the inc folder not an allowed path? How can I make it an allowed path?

Thanks.
Jasper
dandelion
Check the open_basedir directive in your php.ini file.
PHP Manual wrote:
open_basedir string

Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.

When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.

The special value . indicates that the working directory of the script will be used as the base-directory. This is, however, a little dangerous as the working directory of the script can easily be changed with chdir().

In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none".

Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.

The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"

Note: Support for multiple directories was added in 3.0.7.

The default is to allow all files to be opened.
Stubru Freak
In other words, if it's your own server, change it in php.ini, else, you can't, it's a security risk I guess.
Related topics
Google in your scripts
Dynamic PHP Images
uploading files through web browser
PHP Tutorials
PHP - checking lengths
phpbb installation
Cannot use subdomain
Where;s better way using javascript link or write inside htm
PHP and MySQL in windows
Zip Extract Question
Creating a new /config?
What is your directory root on frih?
PHP including images inside images
PHP GD Images Default 75 dpi change to 300dpi??
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.