Following the creative path

DrupalCamp Seattle

Take the day off on June 29th, 2007 and join us at the Annual DrupalCamp Seattle. Tracks for Developers and Users will be held all day. It's free and it will be relaxed environment encouraging creativity and learning. Learn More.

Using PHP and mini_sendmail

Some linux distributions do not include sendmail in their base installation. Other folks may not want to run sendmail. Either way, if you want to use PHP's mail() function and you do not have a mail server installed locally, you need to find another way for mail() to sucessfully send email from a PHP script. mini_sendmail is a good choice for a basic, "I only need to send mail for testing on my development server" type of environment.
  1. Download and compile mini_sendmail.
  2. Create a symbolic link, so it looks like sendmail really exists: ln -s /usr/local/sbin/mini_sendmail /usr/sbin/sendmail
  3. Edit your php.ini file to use appropriate options for sending mail: ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). sendmail_path = /usr/sbin/sendmail -t -ftest@example.com -smail.example.com
  4. Restart apache and that's it.

Notes: I found I needed to supply the From address in the sendmail path; otherwise the mail server I was using would not send the email. I also found that I compiled PHP without setting up mini_sendmail first, so PHP kept giving me the error about mail() not being a declared function. I chose that as a sign to upgrade to PHP 5.2.2. Install mini_sendmail first, then install PHP.

Cloning Computers and Reiser File Systems

For the small business owner, it sure is nice to have one main computer for your work, but what happens when it starts to have hardware problems? What you really want is the ability to take the whole hard drive image and put it on another computer, so your main computer can be fixed.

My main development computer needed a new motherboard. I could run it, but at unexpected times, it would turn off all by itself! I knew it was going to take awhile to fix, so I decided to clone the hard drive onto another machine of the same make (IBM). Knowing that the two machines had the same architecture and hard drive size, I was able to use netcat and dd to do the cloning.

Thanks to an article on datastronghold.com about using netcat and dd, it wasn't too hard to do (although it took a long time, about 10 hours).

On the clone, I booted off a knoppix live CD. I hooked up the two computers with a crossover cable to keep the traffic off of the network. On the clone, I needed an IP address, then the dd and netcat line to receive all of the bits from the main machine (as root):

ifconfig eth0 192.168.1.99 up
netcat -l -p 9000 | dd of=/dev/hda

I send everything on the hard drive from my main development machine like this (as root):

dd if=/dev/hda | netcat 192.168.1.99 9000

This worked really well for the first cloning. I shipped off the broken computer and continued working with the exact setup on my clone. It really kept me going without accidentally forgetting any files (which would have been the case if I just started using any other computer.

After I received my main computer with a new motherboard, then I needed to repeat this process with the computers switched: the main computer is the clone and the clone is the master.

I did run into a problem with knoppix turning on power management, so make sure when you boot off the knoppix CD that you type:

knoppix noapm

to ensure the computer will not "sleep" in the middle of receiving data from the master.

Sadly, I booted my main computer after it was cloned, but it returned this weird error about using "--rebuild-tree" and did not complete the boot process. I hadn't seen that before, but I did find the cyberciti article about repairing the ResierFS file system.

So from the basic linux that was offered up after the error, I typed:

reiserfsck –scan-whole-partition –rebuild-tree /dev/hda1

I repeated this for the second partition as well: /dev/hda2.

The reiserfsck process did a valiant effort in saving files, but it was clear not everything was working properly. For instance, Firefox didn't seem to be installed anymore and my httpd.conf file for my apache server was now in binary.

I decided to give it one more try. I repeated the cloning process above and the second time it worked like a charm! I'm now writing this from my main computer and the clone is available for other uses.

What is nice about this process is that you can run the cloning at night and off of the network. It may take hours to complete, but it's not like you have to sit there and watch it. You can go about your business, then boot up your clone once the process is complete.

Special Thanks to Jim Varnum for providing guidance throughout the whole procedure.

Linuxfest

Linuxfest was a great experience. If you want to learn more about how technology can help your business, this is a great event to attend. If you missed Linuxfest this year in Bellingham, WA, mark your calendar for next year. It is totally worth it.

NADAC Elite Jumpers Title

On April 21, 2007, Emma earned her Elite Jumpers title. The run was absolutely brilliant. We were both focused and ran 4 seconds under stanadard course time (pretty good for a 13 year old).

The NADAC trial was hosted by EAT at Argus Ranch. It is a great location. The rings are indoors, but there is a huge grass field which is were Emma likes to spend her time between runs (ahh, the good life!).

We are starting to compete in Tunnelers again. Emma flew through her first Open Tunnelers run and earned third place (no veterans status in this class so we place against all dogs in her height class; that's my girl!).

The rest of the weekend was a wash. She was too tired to focus for her runs. These days I assume she isn't feeling well, if she starts getting confused on a course. Still I tried to make sure we left the ring together at least finishing the last couple of obstacles. It lets her end on a good note.

I think we will start focusing on obedience for the next couple of months. Summer is coming and that means no agility trials (it's too hot), so we will have time to work on the big 'O'.

Syndicate content