Set the path for open_basedir when setting up Ubercart CC encryption keys

We recently migrated a few of our sites from Dreamhost to Media Temple's dv4.0 service and ran across a couple stumbling blocks getting our encryption key settings in Ubercart to work.

We were getting the following error messages:

You have specified a non-existent directory. and Warning: is_dir(): open_basedir restriction in effect. File(/var/www/vhosts/yourdomain.com/keys) is not within the allowed path(s): (/var/www/vhosts/yourdomain.com/httpdocs/:/tmp/) in uc_credit_settings_form_validate() (line 872 of /var/www/vhosts/yourdomain.com/httpdocs/sites/all/modules/ubercart/payment/uc_credit/uc_credit.module).

If you are also experiencing these issues, and are using MT's dv hosting, then these instructions may be helpful to you.

  1. First we had to Enable Root Access and log into our server via SSH.
  2. Next we typed the following command: cd /var/www/vhosts/yourdomain.com/conf/
  3. Then chown ftpusername conf (Replace ftpusername with the FTP user who needs to have access to the conf folder.)
  4. Once we changed the owner of the conf folder, we connected via FTP and created two text files: vhost.conf and vhost_ssl.conf both containing the following code:

    <Directory /var/www/vhosts/yourdomainnamefolder/httpdocs>

    php_admin_value open_basedir "/var/www/vhosts/yourdomainnamefolder/httpdocs:/tmp:/usr/bin:/var/www/vhosts/yourdomainnamefolder/keys"

    </Directory>

  5. We placed both of the newly created files into the conf folder.
  6. We switched back to our SSH terminal and changed the owner of the conf folder back to root:
    chown root conf
  7. Then we had to reconfigure our web server so that it could find the new files we created and uploaded: /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com
  8. And finally we had to stop and restart Apache with the following commands: /etc/init.d/httpd stop
    /etc/init.d/httpd start
  9. Once all this was done, we went back into our Ubercart Store Payment Settings and used ../keys as our encryption path.

No more errors!