Page 1 of 3

Incorrect open_basedir

Posted: Mon Jan 05, 2015 10:52 pm
by sim
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

Re: Incorrect open_basedir

Posted: Wed Jan 07, 2015 6:04 am
by skurudo
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.;)

Re: Incorrect open_basedir

Posted: Wed Jan 07, 2015 12:22 pm
by sim
Thanks your your answer, i fixed it myself, just can't believe they missed it.

Re: Incorrect open_basedir

Posted: Sun Feb 08, 2015 11:41 am
by patstan

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?

Re: Incorrect open_basedir

Posted: Mon Feb 09, 2015 6:23 am
by skurudo
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>

Re: Incorrect open_basedir

Posted: Wed Nov 16, 2016 11:45 am
by zaqueon
Hi,

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

Thank you.

Re: Incorrect open_basedir

Posted: Tue Dec 06, 2016 2:14 pm
by skurudo
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

Re: Incorrect open_basedir

Posted: Wed Apr 19, 2017 2:07 pm
by Daimko
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 !

Re: Incorrect open_basedir

Posted: Fri Apr 21, 2017 12:43 pm
by ScIT
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).

Re: Incorrect open_basedir

Posted: Sat Apr 22, 2017 8:41 am
by Daimko
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.