Home | Premieres | ScreenPlayLab | CinePaint | MovieEditor | About

Gosh!TV
BooksDVD/Blu-rayFilmGiftsMoneyTVVideo

Gouge: Drupal Postgres on Centos

Installing Drupal on Centos using Postgres instead of MySQL gets a bit tricky

By Robin Rowe

Drupal powers the Obama White House site whitehouse.gov

Drupal powers the Obama White House site whitehouse.gov

HOLLYWOOD, CA (Gosh!TV) 12/22/2009 – Drupal is a popular content publishing program that the White House uses since Obama took office. The standard Drupal installation uses MySQL. Many prefer Postgres because they find it more robust and faster with multiple connections. Drupal supports Postgres (and Sqlite, too). Let’s install on CentOS.

Installing Postgres

  1. # yum install postgresql postgresql-server php-pgsql php-gd
  2. # ln -s /var/lib/pgsql/data/pg_log /var/log/pg_log
  3. Edit /var/lib/pgsql/data/pg_hba.conf  to enable password-based connections:
    #local   all         all                           ident sameuser
    local   all         all                              md5
    # IPv4 local connections:
    #host    all         all         127.0.0.1/32          ident sameuser
    host    all         all         127.0.0.1/32        md5
  4. # /sbin/chkconfig postgresql on
  5. # /sbin/service postgresql start
  6. # /sbin/service httpd restart
  7. # su – postgres
  8. $ psql -d template1 -U postgres
  9. /l
  10. \q
  11. $ createuser drupal –pwprompt –encrypted
  12. Answer n to all questions
  13. $ createdb my_blog_name –owner=drupal
  14. $ psql -l
  15. $ exit

Postgres only has UTF8 encoding, that specifying UNICODE as recommended by Drupal will create a UTF8 table anyway. Since UTF8 is the default encoding, it’s not necessary to specify it in createdb. If Drupal says Postgres is not installed, restart apache. If you install any php modules, you’ll have to restart apache for Drupal to detect them. If that doesn’t help, check /etc/php.d. More Postgres notes.

Testing PHP with Postgres

If you need to check that PHP sees Postgres, create and browse this file looking for a pgsql section:

http://www.my_site.com/drupal-6.14/phpinfo.php

<?
phpinfo();
?>

<?

phpinfo();

?>

If you don’t get a connection, try this test code:

http://www.my_site.copg_connect.php

<?php

$connection = pg_connect(‘user=drupal password=my_password dbname=goshtv’) or die(‘Could not connect: ‘ . pg_last_error($connection));

echo “Connected!”;

?>

Note that pg_last_error gives no error message, is just there to show how it would be used if that worked. You must look in the pg_log.

Installing Drupal

  1. $ cd /var/www/html/
  2. $ wget http://drupal.org/files/projects/drupal-x.x.tar.gz
  3. $ tar xvfz drupal-x.x.tar.gz
  4. $ rm drupal-x.x.tar.gz
  5. # chown -R apache drupal-x.x
  6. # chgrp  -R apache drupal-x.x
  7. # mv drupal-x.x my_blog_name
  8. # cd my_blog_name/sites/default/
  9. # cp default.settings.php settings.php
  10. # chown apache settings.php
  11. # chgrp apache settings.php sites/default/

Configuring Drupal from the Web

  1. http://www.my_site.com/my_blog_name/
  2. http://www.goshtv.net/drupal-6.14/

Setting cron

The web page you’re reading was published using WordPress. Here it is in Drupal:

http://www.goshtv.net/drupal-6.14/

More configuration is necessary with Drupal to create a rich media site like whitehouse.gov. Unlike WordPress, Drupal won’t embed images without installing plug-ins. However, WordPress is MySQL only, doesn’t support Postgres. All database CMS systems are slow and require caching to perform well. WordPress has SuperCache. Drupal has Boost which may be faster as it’s static pages.

Search Gosh!TV