I've read up plenty in the PHP manual about open_basedir and why I'm getting an error (that it's not enabled), but I can't figure out how to set it.

We just got a dedicated server so I'm not used to this sort of thing. It's running FreeBSD, as well as Plesk.

I ran "locate httpd.conf" and found it in /user/local/psa/apache/conf but I can't find any sort of reference to open_basedir.

Am I supposed to just add:

<IfModule sapi_apache2.c>
php_admin_value open_basedir /dir/site/
</IfModule>

somewhere in the file?

Also, if that's the case, what do I set the directory as? Should it be relative to the server root or the site root? As in "/user/local/psa/homst/vhosts/site/" or as in "/"

I assume that will reconfigure the directive for the entire server, but that doesn't matter.

I'm kinda new to this server admin stuff. Thanks guys.

    check this out, I hope works for you or give you a better idea.

    I'm sure everybody who's used Plesk has run into this problem. Where you can't upload anything. There are a couple of hundred threads around here and plesk each telling you different and sometimes similar ways on how to fix it. Well after struggling with my server for hours I've finally came out with a good set of stuff to help you guys out who have plesk installed. I made two versions. One is for all those that don't have a dedicated and ones that do.

    Replace domain.com with your domain that the board is currently on.

    Dedicated Server
    Ok there are a few steps to follow to get it to work.
    1. Log into SSH. (If you for any reason don't have SSH I suggest you install it. I'll post instructions below on how to do that.)
    2. Execute the following command
    pico -w /usr/local/home/vhosts/domain.com/conf/vhost.conf
    3. Inside that file put the following.
    <Directory /usr/local/psa/home/vhosts/metrogamers.com/httpdocs>
    php_admin_value safe_mode 0
    php_admin_value open_basedir "/usr/local/psa/home/vhosts/metrogamers.com/httpdocs:/tmp"
    </Directory>
    Very Important: Make sure it's only 4 lines and no more or less. Extra spaces or lines after </Directory> or before <Directory ...> or even in between the two but make sure that it doesn't have one line open_basedir and then the second "....". Another Important note is this command takes that specific domain out of safe mode which will enable the nix load in your control panel.
    4. Go to your forum control panel and Options > Upload Options and then tell it that safe mode is off.

    That's it! Now you have nix load and upload both working.

    Virtual Host (Shared hosting/no root access)
    1. There's not much that you can do but you can e-mail the instructions to the host admin and I'm sure he'll agree because it doesn't pose a threat. Difference between this one and the dedicated one is you don't get safe mode off unless you've got a host that eighter really really trusts you or has gone crazy. 😉
    2. Same as the above do:
    pico -w /usr/local/home/vhosts/domain.com/conf/vhost.conf
    3. Inside that file put the following.
    <Directory /usr/local/psa/home/vhosts/metrogamers.com/httpdocs>
    php_admin_value open_basedir "/usr/local/psa/home/vhosts/metrogamers.com/httpdocs:/tmp"
    </Directory>
    Very Important: Make sure it's only 3 lines and no more or less. Extra spaces or lines after </Directory> or before <Directory ...> or even in between the two but make sure that it doesn't have one line open_basedir and then the second "....".
    4. Go to your forum control panel and Options > Upload Options and then tell it that safe mode is on and the temp dir is /tmp.

    Installing/upgrading openssh. Right off the bat this text below was taken from another post made by dabystru and he deserves credit for it. If you are wondering what's the difference between the two, here it is. If you use telnet to get your root password all i have to do is listen to port 22. Telnet sends passwords in plain text files. To get the root password when using telnet is extremly easy and a HUGE risk. SSH encryptes the password. If you are going to continue to use shell, install openssh-server (and upgrade openssh-clients to the latest version). By default openssh-server is not installed:[root@plesk admin]# rpm -qa | grep -i ssh
    openssh-clients-2.5.2p2-5
    openssh-2.5.2p2-5
    [root@plesk admin]# rpm -e openssh-clients
    [root@plesk admin]# rpm -U http://customer.saburovo.com/openssh-2.9p2-8.7.i386.rpm
    [root@plesk admin]# rpm -U http://customer.saburovo.com/openssh-clients-2.9p2-8.7.i386.rpm
    [root@plesk admin]# rpm -U http://customer.saburovo.com/openssh-server-2.9p2-8.7.i386.rpm
    rpm -e openssh-clients is needed to remove openssh-clients installation, otherwise openssh will not upgrade to the latest version because of dependency of openssh-clients on the older version (and you can't upgrade openssh-client before upgrading openssh itself).

      Well Alby, I really appreciate your answer, and it certainly was thorough. But here are the problems I ran into while trying it out:

      1) although that folder exists for me, vhost.conf doesn't exist. The only 3 files in the folder are httpd.include httpd.include.new and webalizer.conf -- so running pico (i actually used vi) just created a new file, vhost.conf. I put in the configuration settings you recommended and saved it. Didn't fix anything.

      2) I tried modifying it with things like removing "/httpdocs" from the string, since I'm trying to get to domainroot/secure_includes but that didn't help

      3) I tried following the advice on this page but also, didn't help. Still getting the warning:

      Warning: main(): open_basedir restriction in effect. File(../secure_includes/dbcnx.php) is not within the allowed path(s): (/usr/local/psa/home/vhosts/domain.com/httpdocs:/tmp) in /usr/local/psa/home/vhosts/domain.com/httpdocs/login.php on line 3

      I assume I have to find the place where that value is set. I just don't know how...

      Again, thanks a ton for the response, though.

        Check this out!

        if

        Your vhost.conf...
        Directory /home/httpd/vhosts/u15167800.onlinehome-server.com/httpsdocs
        php_admin_value open_basedir none
        /Directory

        Your vhost_ssl.conf....
        Directory /home/httpd/vhosts/u15167800.onlinehome-server.com/httpsdocs
        php_admin_value open_basedir none
        /Directory

        Notice "none" at the end of the php_admin_value open_basedir line. Change each line in the vhost.conf and vhost_ssl.conf files to the following:

        Your vhost.conf...
        Directory /home/httpd/vhosts/u15167800.onlinehome-server.com/httpdocs
        php_admin_value open_basedir /
        php_admin_value safe_mode 0
        /Directory

        Your vhost_ssl.conf...
        Directory /home/httpd/vhosts/u15167800.onlinehome-server.com/httpsdocs
        php_admin_value open_basedir /
        php_admin_value safe_mode 0
        /Directory

        Notice we changed "none" to " / ".

        To ensure Plesk reads the new settings you have made above, run the following command line:

        /usr/local/psa/admin/sbin/websrvmng -a -v

        By the way what version of pleask you are running?

          Hmm, I got it working! Thanks. What I actually did was try the file httpd.include and that one had all the stuff I needed to change. I gave it a whirl and everything worked out.

          I really appreciate all your help. Thanks alby.

            Write a Reply...