Archive for April, 2010

Sending Redmine mail via Google Apps hosted GMail

So I don’t why I always have trouble setting up web apps to send mail through my hosted GMail accounts (like, um, Redmine?). Really, it seems like I end up pulling my hair out every time I have to do it.

So the problem we want to solve today should be straightforward. I have a Ruby-on-Rails app called Redmine which I want to have send notifications and whatnot via my Google Apps hosted GMail account. So here’s some basic instruction from Redmine. Great. And here is my email.yml file that actually works (passwords and other crap redacted, obviously):

  delivery_method: :smtp
    tls: true
    address: ""
    port: 587
    domain: ""
    authentication: :plain
    user_name: ""
    password: N1ceP@55wurd!

This set-up will allow Redmine to send emails from using hosted GMail

Tags: , , , , ,

Installing Fileinfo on CentOS with PHP 5.2.13

I ran into some trouble installing the Fileinfo extension for PHP on CentOS. I tried installing the extension using yum and all went well until I saw these errors:

PHP Warning:  PHP Startup: fileinfo: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match

Like I said, I installed the extension using yum, so I checked out what I had installed:

$ yum list installed | grep "php-pecl-Fileinfo"
php-pecl-Fileinfo.x86_64               1.0.4-3.el5.centos              installed

Oh crap, I always forget to pull these things from the Atomicorp repository because my php is from there.

$ yum list installed | grep "php.x86_64"
php.x86_64                                   installed

Well, the bad news is that the Fileinfo extension is not available on the Atomicorp repo. Hmm. Ok, so my next step is to remove the thing and install it with PECL.

$ sudo yum erase php-pecl-Fileinfo.x86_64
Running Transaction
  Erasing        : php-pecl-Fileinfo                                                                                         1/1 
warning: /etc/php.d/Fileinfo.ini saved as /etc/php.d/Fileinfo.ini.rpmsave

  php-pecl-Fileinfo.x86_64 0:1.0.4-3.el5.centos                                                                                  

$ sudo rm /etc/php.d/Fileinfo.ini.rpmsave

I didn’t need that config file, because I never got it to work!

Install Fileinfo with PECL

Before anything else, here is the system I’m using:

$ cat /etc/redhat-release 
CentOS release 5.4 (Final)
$ php -v
PHP 5.2.13 (cli) (built: Mar  2 2010 18:08:48) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
$ pecl -V
PEAR Version: 1.9.0
PHP Version: 5.2.13
Zend Engine Version: 2.2.0
Running on: Linux system.local 2.6.18-028stab064.7 #1 SMP Wed Aug 26 13:11:07 MSD 2009 x86_64

If the PHP extension that I’m after is not in the yum repo then I usually just install it with PECL. It is fairly painless.

$ sudo pecl install fileinfo
audit_log_user_command(): Connection refused
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources"
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
running: phpize

...lotsa crap...

build process completed successfully
Installing '/usr/lib64/php/modules/'
install ok: channel://

The PECL warning is trying to let you know that Fileinfo is bundled with PHP 5.3 and you don’t need to install if you are running PHP 5.3, but I’m running 5.2 so that warning is not for me. Okay, now we turn on the extension by putting “” somewhere in the /etc/php.ini file.

$ sudo vim /etc/php.ini

And make the change…


Now restart apache…

$ sudo /sbin/service httpd restart
audit_log_user_command(): Connection refused
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Okay, let’s find out if it is in the phpinfo…

$ php -r "phpinfo();" | grep "fileinfo"
fileinfo support => enabled


Tags: ,