Welcome Guest, Not a member yet? Register   Sign In
Warning: mkdir() [function.mkdir]: open_basedir restriction in effect.
#1

[eluser]Guntars[/eluser]
Hi I need to create directories, and upload pictures outside web root.
when I try to do, shows this error

Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(/var/www/vhosts/webthings.biz/httpdocs/dir/dir) is not within the allowed path(s): (/var/www/vhosts/webthings.biz/subdomains/cms/httpdocs:/tmp) in /var/www/vhosts/webthings.biz/subdomains/cms/httpdocs/mkdir.php on line 8

looks need to change something in php.ini or apache conf.

Anyone can helps exact what need to change?

chmod already is 777
#2

[eluser]TheFuzzy0ne[/eluser]
PHP is running in safe mode. The open_basedir directive needs to be used in the php.ini or httpd.conf.

EDIT: You can add this to your vhost:
Code:
php_admin_flag safe_mode off
#3

[eluser]Guntars[/eluser]
Hmm, where you think need to change, because on phpinfo shows safe mode off. I use debian linux.
In main conf file have this line

Code:
<Directory "/var/www/vhosts">
    AllowOverride All
    Options SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    
    <IfModule mod_php4.c>
    php_admin_flag engine off
php_admin_flag safe_mode off
    </IfModule>
    <IfModule mod_php5.c>
    php_admin_flag engine off
php_admin_flag safe_mode off
    </IfModule>
</Directory>

Any Ideas? just I can create in web root directory, but can't in outside root. I was use this thing on other servers, and never has problems before.
#4

[eluser]Guntars[/eluser]
Hi I find solution
I uncoment
# php_admin_value open_basedir "/var/www/vhosts/webthings.biz/httpdocs:/tmp"
in conf file.
Code:
php_admin_flag engine on
        php_admin_flag safe_mode off
    #    php_admin_value open_basedir "/var/www/vhosts/webthings.biz/httpdocs:/tmp"

Thaks a lot for help
#5

[eluser]TheFuzzy0ne[/eluser]
Sure. What you have should work anyway, although simply replacing what you have, with this should work too.

Code:
<Directory "/var/www/vhosts">
    AllowOverride All
    Options SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    php_admin_flag safe_mode off
    
    <IfModule mod_php4.c>
        php_admin_flag engine off
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_flag engine off
    </IfModule>
</Directory>

Once you're done, you'll need to reload Apache. Assuming you're in an account with administrative privileges, the following should do that nicely.
Code:
/etc/init.d/apache2 force-reload

EDIT: Glad you got it sorted.
#6

[eluser]joshua rajamani[/eluser]
how can do without reload the server.
#7

[eluser]TheFuzzy0ne[/eluser]
You can't. It's something that must be set in the httpd.conf file or the vhost file. If you're having problems, I'd suggest you take it up with your Web host. I believe that only they have the power to change this, and that it's been put in place for a good reason.




Theme © iAndrew 2016 - Forum software by © MyBB