Fixing VestaCP open_basedir error

So, this. This has been a pain in the ass for EVER. Every time I install VestaCP, I have to fix this before doing anything else with my code.

This issue wasn’t there when I started using VestaCP. Then came an update. Yeah, you get my point. 😡

I know it’s good for security. But still it’s a pain. So here’s how to get stuff working.

Please replace the following things with yours in my commands.

  • User: admin
  • Domain:
  • Text-Editor: nano
  • Folder I want include files from: /home/%user%/web/%domain%/project
  1. Change directory to your VestaCP user’s web config folder
    cd /home/admin/conf/web
  2. List files
    ls -la

    You should see some files like
  3. Open up ‘‘ in a text editor
    Content will be similar to the follwing

    <VirtualHost ***.***.***.***:****>
        DocumentRoot /home/admin/web/
        ScriptAlias /cgi-bin/ /home/admin/web/
        Alias /vstats/ /home/admin/web/
        Alias /error/ /home/admin/web/
        #SuexecUserGroup admin admin
        CustomLog /var/log/httpd/domains/ bytes
        CustomLog /var/log/httpd/domains/ combined
        ErrorLog /var/log/httpd/domains/
        <Directory /home/admin/web/>
            AllowOverride All
            Options +Includes -Indexes +ExecCGI
            php_admin_value open_basedir /home/admin/web/
            php_admin_value upload_tmp_dir /home/admin/tmp
            php_admin_value session.save_path /home/admin/tmp
        <Directory /home/admin/web/>
            AllowOverride All
        <IfModule mod_ruid2.c>
            RMode config
            RUidGid admin admin
            RGroups apache
        <IfModule itk.c>
            AssignUserID admin admin
        IncludeOptional /home/admin/conf/web/*
  4. Append the folder you want to ‘php_admin_value open_basedir‘ like the following example
    php_admin_value open_basedir /home/admin/web/
  5. Save and quit the file
  6. Restart Apache Server
    You could use the VestaCP interface to restart the Apache Server OR use the following command

    service httpd restart



3 thoughts on “Fixing VestaCP open_basedir error

    1. Thank you for commenting. I see you have fixed your problem. But I suggest you to manually add the path to open_basedir config rather than turning it off, since that might make your server vulnerable.

      You could fix your problem appending ‘/tmp’ at the end of open_basedir value as shown below

      php_admin_value open_basedir /home/admin/web/


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s