Development sites and production sites; host and local servers
When I develop a new website, say for my blog, I set up a mock version on my laptop. In techy-speak, I am using a “development site” on a “server” on “local host”. When the website is ready, I move it to my hosting service (in my case Dreamhost in the US). That is my “production site” and the website will thereafter physically reside on their servers and they will be the host.
Set up WAMP
I use a standard laptop to develop my websites. This one has Windows 7. My last one had Windows XP, and so on. To set up my local server, I download WAMP. As I only download WAMP when I have a new computer, I follow the instructions on LifeHacker, which are very clear.
Basically, I arrive at an arrangement where I have
- A directory in C: called C:wamp
- A program under C:ProgramFiles called WampServer where I can fire up WAMP (I leave WAMP off when I am not using it)
- Within C:wamp is C:wampwww where my websites are stored
- And within WampServer is access to localhost, PHP and MySQL. PHP runs the server and MySQL sets up databases to store blogs.
It is all rather baffling at first but set aside a quiet Sunday afternoon and work methodically. You will manage fine.
Set up email for a development site on WAMP
This post is about setting up email to work with a development site. I never bothered to set it up for my WordPress mockups because I already knew how WordPress worked and I could fast forward in my mind to what the production site would look like. But yesterday, I downloaded Elgg to develop a social network and I really wanted to test the email functionality. So this is how I set up email functionality for WAMP.
The basic principles are that I downloaded an email service called sendmail and I edited my PHP.ini file. Both are easy and I will go into the details just now. This paragraph is to record an important point. The set up changed the default email in the PHP.ini file. This is why that matters. It is highly probable that each development site has a different email address. The solution in this email assumes that the same email address is used with every site. Either use the same email address for all your development sites or remember to change the sendmail.ini each time you change sites (and possibly the php.ini as well). Whatever, don’t be surprised if something breaks. This could be the cause.
How to set up email for WAMP in three steps
#1 Download sendmail into a the c:wampbinsendmail
You will know you are in the right place because bin has directories for PHP and MySQL
#2 Edit sendmail.ini in a text editor
I linked to a gmail account so at the date of writing (April 2012), look for these lines and fix them accordingly
NB I am using an email address that works with Google Apps so the gmail.com in my email address actually read firstname.lastname@example.org
#3 Edit your php.ini file
On my version of Windows 7, I start my WampServer by finding it on the All Programs list. Then I look on the bottom tool bar for an upward arrow. I activate WAMP with the big W. Once it turns green, I can find everything that comes with WAMP.
I select PHP and open PHP.ini in a text editor. I find “mail function” and I will now edit it out all mail settings AND add a path directing WAMP to the sendmail that I just set up. These are the important lines.
; For Win32 only.
; SMTP =
; smtp_port = 25
; For Win32 only.
; sendmail_from = an email address that is already there
; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
sendmail_path = C:wampbinsendmailsendmail.exe -t
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
; mail.force_extra_parameters =
In short, make sure all the lines but one start with a semi-colon and copy the path line above.
And restart your server by pressing the arrow on the tool bar, selecting W, and “restart all services”.
Now test your email service. You should be able to send an email from Elgg (or any other service). So try it – send an email from your development website (the email address does match what you put in sendmail.ini, right?) to another of your email addresses and go to see it it arrives within seconds.
Done! You have set up email functionality in WAMP.
Make your own notes so you can do it again. And importantly, recall what you have done when you move to a production site or start another development site. Write your own notes! It only takes a few minutes!