Monday, December 07, 2009

GMAIL SMTP with Joomla

Well after spending forever on trying to figure out how I could use gmail or in my case google aps on my joomla account, I will spread this information to the community!

This is a very simple "hack" to the code that will allow you to send email with google's smtp server:

You will have to locate the file that will be changed based on which version of Joomla! you have.

phpmailer.php file in 1.5

on line 537 or close to it

The original code would be something like:
if(strstr($hosts[$index], ":"))
list($host, $port) = explode(":", $hosts[$index]);
else
{
$host = $hosts[$index];
$port = $this->Port;
}

You must change this to:

if (preg_match('#(([a-z]+://)?[^:]+):(\d+)#i', $hosts[$index], $match))
{
$host = $match[1];
$port = $match[3];
}
else
{
$host = $hosts[$index];
$port = $this->Port;
}

and ofcourse you have to enter the SMTP details under Global Configurations page after login to Joomla Administration page.

Saturday, December 05, 2009

PostgreSQL on EBS

Following are the steps to run PostgreSQL database on EBS drive on Amazon EC2 instance

1) from the Amazon EC2 console, create a new colume and attach that to the running instance.

[consider this example when you attached that on /dev/sdi from the console]

2) Format & Mount the disk using the following commands from the Terminal
sudo modprobe xfs
sudo mkfs.xfs /dev/sdi

echo "/dev/sdi /media/PostgresLiveDB xfs noatime 0 0" | sudo tee -a /etc/fstab
sudo mkdir /media/PostgresLiveDB
sudo mount /media/PostgresLiveDB
copy paste the data folder from the postgres installation diretory to this EBS drive

3) make sure you give the file permission of the EBS to postgres user
# change to the data directory
cd /media/PostgresLiveDB/data
# chown the files
find . -type f -exec chown postgres:postgres {} \;
# chown the directories
find . -type d -exec chown postgres:postgres {} \;
# and then the data directory itself
chown postgres:postgres /media/PostgresLiveDB/data
#and
sudo chmod 700 /media/PostgresLiveDB/data

check the permissions at each directory using ls -l

4)- stop the postgresql server using /etc/init.d/postgresql-8.3 stop
- you can rename the data folder presents in installation directory to databackup or so. just to maintain a backup folder to cross check.
- open the file /etc/init.d/postgresql-8.3 and edit the data paths properly
- edit the data directory path properly in /etc/postgresql/8.3/main/postgresql.conf

5) - start the postgresql server using /etc/init.d/postgresql-8.3 start

Cheers! you are done..

Thursday, December 03, 2009

Amazon EC2 Linux

Small Instance AMI

Large Instance AMI