Nov 2006
30
02:43am


Yes, I got it working!

A couple of days ago, I was able to successfully setup PHP4 and PHP5 running side-by-side on my server. Since this setup requires PHP5 to run on FastCGI (FCGI), I decided to install Ruby on my server as well. The install was easy with cPanel as I only needed to execute the following line (note that this is on cPanel):

chmod +x /scripts/installruby; /scripts/installruby

That alone downloaded, compiled and installed Ruby and Rails. Since FCGI is already setup on my server, I decided to give Ruby on Rails a spin. CGI mode was working fine but when I tweaked the .htaccess to make use of FCGI, it didn’t seem to work. A view of the log file says:

Dispatcher failed to catch: undefined method `is_cgi?’ for FCGI:Class (NoMethodError)
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:605:in `each_cgi’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in `process!’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in `process!’
dispatch.fcgi:24
OK - that’s ugly. I immediately turned on to my good old friend Google to ask for help. As usual, tons of suggestions from other users came up but none of them worked. An hour and a half later, I came across one blog that recommends to add the following line dispatch.fcgi just before require ‘fcgi_handler’:

FCGI_PURE_RUBY = true

I tried it out and it did work BUT I knew there’s something wrong with this solution. It’s not a global solution and since I run a web hosting business, telling my clients who would use Ruby on Rails to insert that line in dispatch.fcgi would be a no-no. So I searched for a better solution and guess what - I found one! To my amazement, I found the solution at the bottom of the Ruby on Rails FastCGI wiki itself.

The solution was simple and is accomplished in two steps (root access required):

  1. Edit /etc/ld.so.conf and add /usr/local/lib at the bottom
  2. Run /sbin/ldconfig

Geez! That was it! Easy as that. Now, I have Ruby on Rails running on my server - more options more clients!



Nov 2006
28
04:01am

I run a web hosting business. Recently, Benj (who also runs a similar business) decided to upgrade his server to PHP5 and trash PHP4 altogether. I knew that it’s gonna cause him headaches so I stuck with my plan of running PHP4 and PHP5 side-by-side so existing websites will still run as they were while clients who wish to use the features of PHP5 can do so as well. In my setup, PHP4 runs as an Apache module while PHP5 runs under FastCGI. By default, .php is handled by PHP4 and .php5 by PHP5. So to make use of PHP5, all that needs to be done is use .php5 as the filename extension or if you want to override the defaults and use .php for PHP5 scripts, then you can just add the following line in .htaccess:

AddType application/x-httpd-php5 .php

It took me less than one hour to finish it and I never knew that it was this simple.

Next thing to do - Ruby on Rails.

Click here for instructions to setup PHP4 and PHP5 side-by-side.


Nov 2006
20
12:35pm

Spam is one heck of a headache if you’re running a shared server or even a dedicated server. Though exim maintains a log file of all mails sent, it doesn’t really give you much info when mails are sent via PHP’s mail function. This is because PHP and Apache simply doesn’t keep track of these emails though 99% of mails sent via PHP uses the built-in mail function.

To solve this problem, here’s a quick and simple solution to know who ‘nobody’ really is. By the way, this solution assumes that you’re using Apache, PHP and Exim. Also this solution was tested only on a CPanel/WHM system.
Note: You will root access to your server to do this.

1. SSH to your server as root

2. Stop Exim for a while:

/etc/init.d/exim stop

3. Backup your original sendmail file:

mv /usr/sbin/sendmail /usr/sbin/sendmail.hidden

4. Create our sendmail hook:

pico /usr/sbin/sendmail

- and paste the following -

#!/usr/local/bin/perl
# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, “>>/var/log/spam_log”) || die “Failed to open file ::$!”;
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
    print INFO “$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME \n”;
}
else {
     print INFO “$date - $PWD - @info\n”;
}
my $mailprog = ‘/usr/sbin/sendmail.hidden’;
foreach (@ARGV) {
     $arg=”$arg” . ” $_”;
}
open (MAIL,”|$mailprog $arg”) || die “cannot open $mailprog: $!n”;
while (<STDIN> ) { {
     print MAIL;
}
close (INFO);
close (MAIL);

5. Make our sendmail hook executable:

chmod +x /usr/sbin/sendmail

6. Protect our sendmail hook from being overwritten:

chattr +i /usr/sbin/sendmail

7. Create our log file:

touch /var/log/spam_log; chmod 0644 /var/log/spam_log

8. Start Exim again:

/etc/init.d/exim start

9. Add your log file to log rotation:

pico /etc/logrotate.conf

- search for -

/var/log/wtmp {
     monthly
     create 0664 root utmp
     rotate 1
}

- add this below -

# SPAM LOG rotation
/var/log/spam_log {
     monthly
     create 0777 root root
     rotate 1
}

That’s it! Now, you can view your log file at /var/log/spam_log and track down those spammers.


Spammers getting smarter?

Posted by Mike Lopez under Technology
No Comments
Nov 2006
17
04:20pm

With the advent of heuristic anti-spam softwares and spam databases, many thought that the lives of spammers will be over but it didn’t.  Spammers still manage to get away with their spam tactics and even manage to make money out of it.

A few months ago, after enjoying lots of months with very little spam in my inbox, I started getting a new breed of spam mails.  This time, they contain graphics.  Without text, it will be impossible to trigger heuristic flags on whether an email is spam or not.  What these annoying spammers do is type their message in an image editing program, save it as GIF, and email the GIF image.  This way, the recipient reads the message but anti-spam software can’t.

In my head, I knew that sooner or later, anti-spam software will be able to catch this spammy GIF images through OCR or Optical Character Recognition but just before I saw the good guys develop the needed techniques, I started seeing a new and evolved version of the GIF image spam emails.  Take a look at the image below (note, I’m in no way endorsing whatever they are offering):

SPAM GIF

Notice how the letters are waved to make it difficult for OCR software to recognize the message.  Furthermore, the background of the image is some sort of an abstract picture making it even harder for OCR to read it.  It looks like more of a Captcha image which is used by the good guys to prevent spam - this time, the spammers are using the same idea to protect their spam.

This indeed is a classic example of bad guys using the tools of the good guys to make bad things.  I just hope that someone will be able to stop all these spam so that we can all live with a clean inbox.

If you’re determined to stop SPAM, I would recommend Spam Bully for Outlook and Outlook Express users.  For all the rest, I recommend Spamweed.  Another one that I also strongly recommend is THIS.


Nov 2006
13
07:00pm

In the past year, I’ve covered two different proposals on using space technology to create some sort of “shade” for the entire planet that would save us from global warming. In covering those stories, words like “radical” and even “outlandish” seemed appropriate.

Now, NASA has actually funded a more thorough study of a third “sunshade” proposal. Should I be worried that the government is actually thinking they need some sort of space-based fallback plan for the global warming problem?

Continue reading this article at SPACE.com — Space-Based Sun-Shade Concept a Bright Idea


Flash Player 9 for Linux

Posted by Mike Lopez under Technology
4 Comments
Nov 2006
03
06:21pm

Linux users have been waiting for a very very very very (1 million more very’s here) long time for Adobe to come up with Flash player 9 for Linux.  Until now, we Linux users are officially bound to Flash player 7 only, or are we?

If you’re up to it my dear Linux user, you can go ahead and try Flash Player 9 beta for Linux.  I tried it and it works fine.  Here’s how to set it up as a plugin for Firefox.

  1. Download Flash Player 9 for Linux here - http://labs.adobe.com/downloads/flashplayer9.html
  2. Extract the contents of the downloaded file
  3. Copy the libflashplayer.so to your ~/.mozilla/plugins/ directory
  4. You may also want to copy libflashplayer.so to your /usr/lib/firefox/plugins/ directory as well
  5. Restart Firefox.

Note that paths may vary on different flavors of Linux.  Let me know if you got it working.