open_basedir restriction in effect. File(/) is not within the allowed path(s):

后端 未结 13 2364
醉话见心
醉话见心 2020-11-22 01:45

I\'m getting this error on an avatar upload on my site. I\'ve never gotten it before and nothing was changed recently for me to begin getting this error...

         


        
13条回答
  •  余生分开走
    2020-11-22 02:32

    In addition to @yogihosting's answer, if you are using DirectAdmin, then follow these steps:

    1. Go to the DirectAdmin's login page. Usually, its port is 2222.
    2. Login as administrator. Its username is admin by default.
    3. From the "Access Level" on the right panel, make sure you are on "Admin Level". If not, change to it.
    4. From the "Extra Features" section, click on "Custom HTTPD Configurations".
    5. Choose the domain you want to change.
    6. Enter the configurations you want to change in the textarea at the top of the page. You should consider the existing configuration file and modify values based on it. For example, if you see that open_basedir is set inside a , maybe you should surround your change in the related tag:

      
          php_admin_value open_basedir none
      
      
    7. After making necessary changes, click on the "Save" button.

    8. You should now see your changes saved to the configuration file if they were valid.

    There is another way of editing the configuration file, however:

    Caution: Be careful, and use the following steps at your own risk, as you may run into errors, or it may lead to downtime. The recommended way is the previous one, as it prevents you from modifying configuration file improperly and show you the error.

    1. Login to your server as root.
    2. Go to /usr/local/directadmin/data/users. From the listed users, go to one related to the domain you want to change.
    3. Here, there is an httpd.conf file. Make a backup from it:

      cp httpd.conf httpd.conf.back
      
    4. Now edit the configuration file with your editor of choice. For example, edit existing open_basedir to none. Do not try to remove things, or you may experience downtime. Save the file after editing.

    5. Restart the Apache web server using one of the following ways (use sudo if needed):

      httpd -k graceful
      apachectl -k graceful
      apache2 -k graceful
      
    6. If your encounter any errors, then replace the main configuration file with the backed-up file, and restart the web server.

    Again, the first solution is the preferred one, and you should not try the second method at the first time. As it is noted in the caution, the advantage of the first way is that it prevents saving your bad-configured stuff.

    Hope it helps!

提交回复
热议问题