A short note about moving internal Drupal CMS site from test to the production

Target platform: Windows 2003 R2 x64, let’s call the production server PROD (of course, as always, all names, passwords and paths are obfuscated)

Packages installed on PROD:

  • MySQL 5.1.28-RC-WINX64.msi (x64) – be careful and pick mirror that offers msi file and not exe. At first I downloaded from local mirror (Slovenia) and got .exe file that I couldn’t run on Windows x64.
  • Apache 2.2.10 (win32)
  • PHP 5.2.6 (win32) with mysql extension

Prepare empty MySQL database on PROD for Drupal:

cmd> mysqladmin -u root -p create drupal
cmd> mysql -u root -p
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'topsecret';
mysql> flush privileges

Export Drupal database on TEST and import on PROD:

cmd@test> mysqldump -u root -p drupal > drupal.sql

cmd@prod> mysql -u drupaluser -p drupal < drupal.sql

Copy Drupal files from Apache\htmldoc on test server to the same directory on production server. Check Drupal configuration file (settings.php) file for MySQL connection (especially for a valid password that is needed to connect to MySQL).

I did the following changes in configuration files:

PHP.INI

I turned on the php_mysql.dll PHP extension:
[PHP_MYSQL]
extension=php_mysql.dll

All other PHP extensions I turned off with semicolon in front of the extension keyword (;).
Also, I copied libmysql.dll from PHP directory to Apache\bin directory.

Apache (httpd.conf)
I added index.php and index.htm in directoryIndex:

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.

    DirectoryIndex index.php index.html index.htm

…as well as some aliases for static content, such as:

Alias /doc "X:/DOCUMENTATION"

    Options Indexes
    AllowOverride None
    Order allow,deny
    Allow from all

MySQL (my.ini)

I added init-connet to my.ini at the server side, the reason for this is explained in this thread.

[mysqld]
init-connect="SET NAMES cp1250"
Advertisement

Posted on 20.10.2008, in Linux, PostgreSQL, etc. and tagged , . Bookmark the permalink. 1 Comment.

  1. Reserved words in MySQL 5.1
    Another gotcha that I needed to fix (outside of Drupal scope) today was one particular MySQL 4.0 table named schema that needed to be exported from MySQL 4.0 and imported in 5.1. I found that schema is a reserved word in 5.1 (refer to reserved words) and as such inconvenient to work with. Table name and/or column name must be enclosed with back quotes, for example: select * from `schema`. Not something I would want to fiddle with. Instead I renamed table name and column name on source database (4.0) before exporting/importing to 5.1. Of course, application was modified as well.

    mysql> rename table schema to oschema; # change table name
    mysql> alter table oschema change column schema oschema varchar(30); # change column name