Create a Development Drupal Environment
These instructions describe how to set up a development copy of your live Drupal site within the Stanford web environment.
- Create a new database (at https://tools.stanford.edu/cgi-bin/sumysql/sumysql). This will give you a database user name and password, stored in a file at /afs/ir/group/mygroup/db_private/db_info
- SSH into corn
ssh sunetid@corn.stanford.edu
Enter your password when prompted
- Change into the production Drupal directory
cd /afs/ir/group/mygroup/cgi-bin/drupal
- Create a dump file of the database
drush sql-dump --result-file=dbdump.sql
- Move up one directory
- Make a copy of the production directory
- Move into the development directory
- Edit the .htaccess file; you want to change the line that starts with "RewriteBase" so that it reflects the new development directory
RewriteBase /group/mygroup/cgi-bin/drupal-dev
- Edit the settings.php file (usually in sites/default) to point to your new, development database
Drupal 6
$db_url = 'mysqli://newusername:newpassword@127.0.0.1/newdatabasename';
Drupal 7
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'newdatabasename',
'username' => 'newusername',
'password' => 'newpassword',
'host' => '127.0.0.1',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
),
),
);
- (If applicable) Comment out the line that starts with $base_url in sites/default/settings.php:
// $base_url = 'https://myvanityurl.stanford.edu'; // NO trailing slash!
- Populate the new database from your database dump file
mysql -f -u username -ppassword -h 127.0.0.1 databasename < dbdump.sql
- (If applicable) Disable the Reverse Proxy module
drush -y dis reverse_proxy
- Visit your site at http://www.stanford.edu/group/mygroup/cgi-bin/drupal-dev. (Note: the WebAuth Module for Drupal (WMD) may not work on the development site.)
- Remember to delete your database dumps (dbdump.sql) from the Drupal directory in both the production and development Drupal installs. These should not be web-accessible.