Drupal: open_basedir errors when setting up Ubercart CC encryption keys

Submitted by jpamental on
Topics:  drupal development

[these are tailored to the Media Temple (dv) environment, but are pretty portable to other Linux/CentOS systems]

Basics of the issue are covered in this support article here:
http://kb.parallels.com/en/432

Basically, you need to look in the root directory for your site (where the httpdocs folder is living)

First thing is to connect via SSH and move to that root directory. Usually:

/var/www/vhosts/yourdomainnamefolder


then make the ‘keys’ folder (or whatever you want to call it)

this works:

mkdir keys


(leaving it owned by root or by the account owner of the rest of the folders is fine)

then:

chmod 777 keys


This enables writing in that directory so Ubercart can create its keyfile.

Then you need to create 2 files in the ‘conf’ directory (same directory as httpdocs and keys)

Media Temple as the vi editor installed, so commands are like so:

cd conf <enter> (so you are in the conf directory)

 

touch vhost.conf <enter> (creates an empty file of that name)

 

vi vhost.conf <enter>


Now you’re in the vi editor and you have a blank file.

Type in:

i <enter>


You should now be in ‘insert’ mode

Copy/paste this into the file: (or type if you need to)

<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>


Just update the above with the name of the root folder for your site.

To save, hit ‘escape’

then

:w <enter>

(writes the changes to the file)

:q <enter>

(quits the program)

Now step and repeat: do the same thing for ‘vhost_ssl.conf’

Now 2 steps left:

enter this command:

/usr/local/psa/admin/sbin/websrvmng -a -v <enter>


and restart Apache:

apachectl restart


Prep is done. Now you can confiure the Ubercart settings
yourdomain.com/admin/store/settings/payment/edit/methods

Expand ‘Credit Card Settings’ and you’ll see a text box where you need to put in:

../keys (or whatever you named your folder)


and click save settings. You should see a status message indicating success and that Ubercart has saved its encryption file and can now process CC’s.

Lastly, go back to the directory containing ‘keys’ in your Terminal window and change permissions back to 755:

chmod 755 keys

UPDATE

Got this from my friend John (@johnpicozzi) regarding Media Temple’s (dv) 4’s:

 

Just wanted to give you a heads up… The code in your Keys setup needs a small update for DV 4.0.

Here is the code

<Directory "/var/www/vhosts/yourdomainnamefolder/">
php_admin_value open_basedir “/var/www/vhosts/yourdomainnamefolder/httpdocs:/tmp:/usr/bin:/var/www/vhosts/yourdomainnamefolder/keys”
</Directory>


Notice in the first directory tag we added the ” and took out the httpdocs

I haven’t tested this 100 percent but the other way made my server crash

Comments

Thanks for this!