open_basedir including public_html but not home directory of user

aww

Well-Known Member
Feb 10, 2005
152
0
166
cPanel Access Level
Root Administrator
On a relatively new cpanel install but I noticed only /home/username/public_html is included in open_basedir, not /home/username

open_basedir restriction in effect.
xxxxxxx is not within the allowed path(s): (/home/username/public_html:/usr/lib/php:/usr/local/lib/php:/tmp)
Is there an easy way to add /home/username this and regenerate open_basedir for all users?

Or is it still like it was years ago where you have to completely rebuild apache via easy apache to fix?
 

aww

Well-Known Member
Feb 10, 2005
152
0
166
cPanel Access Level
Root Administrator
in /var/cpanel/templates/apache2/vhost.default
I see the vhost.homedir included - is that not /home/username ? it's actually /home/username/public_html ?

Code:
 <IfModule concurrent_php.c>
        php4_admin_value open_basedir "[% vhost.homedir %]:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/ph$
        php5_admin_value open_basedir "[% vhost.homedir %]:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "[% vhost.homedir %]:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib$
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "[% vhost.homedir %]:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "[% vhost.homedir %]:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib$
        </IfModule>
 

aww

Well-Known Member
Feb 10, 2005
152
0
166
cPanel Access Level
Root Administrator
aha! I found it

it's actually in /var/cpanel/templates/apache2/vhost.local

it's set to

php_admin_value open_basedir "[% vhost.documentroot %]

instead of

php_admin_value open_basedir "[% vhost.homedir %]

so I guess search/replace all that and run

/usr/local/cpanel/bin/apache_conf_distiller --update
/usr/local/cpanel/bin/build_apache_conf
service httpd restart
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
/var/cpanel/templates/apache2/vhost.local would be a revised copy that is user created rather than the default one. The default one we provide is vhost.default rather than vhost.local