(Jan 22) Release 0.9.8-19 with bug fixes available now. Run this command for update v-update-sys-vesta-all

Incorrect open_basedir Topic is solved

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Forum rules
Before creating a new topic or reply on the forum you should fill out additional fields "Os" and "Web" in your profile section.
In case of violation, the topic can be closed or response from the support will not be received.
sim
Posts: 101
Joined: Sat Nov 22, 2014 7:47 pm

Incorrect open_basedir

Postby sim » Mon Jan 05, 2015 10:52 pm

When using basedir template, you won't be able to manage uploaded files, because open_basedir restriction is set only to the public_html.

Is this a bug?

Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/user/web/domain.com/public_html) in Unknown on line 0, referer: http://domain.lt/ordo/wp-admin/post.php ... ction=edit
PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

skurudo
VestaCP Team
Posts: 7808
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: Incorrect open_basedir

Postby skurudo » Wed Jan 07, 2015 6:04 am

sim wrote:When using basedir template, you won't be able to manage uploaded files, because open_basedir restriction is set only to the public_html.

Is this a bug?

Unknown: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/user/web/domain.com/public_html) in Unknown on line 0, referer: http://domain.lt/ordo/wp-admin/post.php ... ction=edit
PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0


You can disble open_basedir (not good idea)

Code: Select all

 <Directory /home/%user%/web/%domain%/public_html>
        php_admin_value open_basedir none
    </Directory>


Or you can add to /usr/local/vesta/data/templates/web/apache2/basedir.tpl / basedir.stpl (or which you use for domain) a little fix:

Code: Select all

php_admin_value open_basedir %docroot%:%home%/%user%/tmp
php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp


Rebuild web for domain from control panel and restart apache2 from Services.

PS: Yeah, it's a bug. I read about it from this forum, but can't find where. Sorry.;)

sim
Posts: 101
Joined: Sat Nov 22, 2014 7:47 pm

Re: Incorrect open_basedir

Postby sim » Wed Jan 07, 2015 12:22 pm

Thanks your your answer, i fixed it myself, just can't believe they missed it.

patstan
Posts: 114
Joined: Wed Jul 30, 2014 10:53 am

Re: Incorrect open_basedir

Postby patstan » Sun Feb 08, 2015 11:41 am

Code: Select all

php_admin_value open_basedir %docroot%:%home%/%user%/tmp
php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp


Do i add this directly to the bottom of this template?

skurudo
VestaCP Team
Posts: 7808
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: Incorrect open_basedir

Postby skurudo » Mon Feb 09, 2015 6:23 am

No, no, no - in directory

Let's show full template /usr/local/vesta/data/templates/web/apache2/basedir.stpl:

Code: Select all

<VirtualHost %ip%:%web_ssl_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
    DocumentRoot %sdocroot%
    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log
    <Directory %sdocroot%>
        AllowOverride All
        SSLRequireSSL
        Options +Includes -Indexes +ExecCGI
php_admin_value open_basedir %docroot%:%home%/%user%/tmp
php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f info@%domain%"
    </Directory>
    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    </Directory>
    SSLEngine on
    SSLVerifyClient none
    SSLCertificateFile %ssl_crt%
    SSLCertificateKeyFile %ssl_key%
    %ssl_ca_str%SSLCertificateChainFile %ssl_ca%

    <IfModule mod_ruid2.c>
        RMode config
        RUidGid %user% %group%
        RGroups www-data
    </IfModule>
    <IfModule itk.c>
        AssignUserID %user% %group%
    </IfModule>

    Include %home%/%user%/conf/web/s%web_system%.%domain%.conf*

</VirtualHost>

zaqueon
Posts: 5
Joined: Thu Nov 06, 2014 9:24 am
Contact:

Re: Incorrect open_basedir

Postby zaqueon » Wed Nov 16, 2016 11:45 am

Hi,

There is no such folder in my centos7.
Can you tell me the correct folder in centos7?

Thank you.

skurudo
VestaCP Team
Posts: 7808
Joined: Fri Dec 26, 2014 2:23 pm
Contact:

Re: Incorrect open_basedir

Postby skurudo » Tue Dec 06, 2016 2:14 pm

zaqueon wrote:There is no such folder in my centos7.
Can you tell me the correct folder in centos7?


apache2 in centos has name httpd

/usr/local/vesta/data/templates/web/httpd/basedir.stpl
-> DigitalOcean competition - please, support us
-> fix for phpmyadmin - nice and sweet now

Daimko
Posts: 22
Joined: Sun Mar 26, 2017 9:43 pm

Os: Debian 8x
Web: apache + nginx

Re: Incorrect open_basedir

Postby Daimko » Wed Apr 19, 2017 2:07 pm

Hello,

I'm having the same problem on: http://refugio-pineta.es.
The 3 lines are already present in the 2 files so how do ?

Code: Select all

php_admin_value open_basedir %docroot%:%home%/%user%/tmp
php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp


Thanks in advance for your help !

ScIT
Posts: 335
Joined: Mon Feb 23, 2015 4:13 pm

Os: Ubuntu 16x
Web: apache + nginx

Re: Incorrect open_basedir

Postby ScIT » Fri Apr 21, 2017 12:43 pm

Daimko wrote:Hello,

I'm having the same problem on: http://refugio-pineta.es.
The 3 lines are already present in the 2 files so how do ?

Code: Select all

php_admin_value open_basedir %docroot%:%home%/%user%/tmp
php_admin_value upload_tmp_dir %home%/%user%/tmp
php_admin_value session.save_path %home%/%user%/tmp


Thanks in advance for your help !


Just add /tmp to the open_basedir list:

Code: Select all

php_admin_value open_basedir %docroot%:%home%/%user%/tmp:/tmp


But it's better to create a new, own template in /usr/local/vesta/data/web/apache2/ (just copy default.tpl and default.stpl to a new name (forexample test.tpl/test.stpl) and change the files).

Daimko
Posts: 22
Joined: Sun Mar 26, 2017 9:43 pm

Os: Debian 8x
Web: apache + nginx

Re: Incorrect open_basedir

Postby Daimko » Sat Apr 22, 2017 8:41 am

The problem is still present :

Code: Select all

Warning: file_exists (): open_basedir restriction in effect. File (/ home / u941222742 / public_html / wp-content / uploads / 2017/04) (/home/admin/web/refugio-pineta.es/public_html:/home/admin/ Tmp) in /home/admin/web/refugio-pineta.es/public_html/wp-includes/functions.php on line 1611


An idea ?
Thank you in advance for your help.


Return to “Web Server”



Who is online

Users browsing this forum: No registered users and 3 guests