Showing posts with label guide. Show all posts
Showing posts with label guide. Show all posts

Saturday, February 03, 2007

Complete Idiot's Guide to WAMP

So, you got it in your head for some reason that you want to run a webserver on your Windows machine? With PHP, MySQL and all that fancy jazz? Well so did I, so I wrote this little guide after mucking about for two days, following various guides that didn't work, were incomplete, incorrect or outdated.

If you're like me, you have been using one of the preconfigured packages, like EasyPHP or XAMPP. The problem is, after using that for about a year, new versions of PHP, Apache and MySQL popped up left and right. And new versions of those handy packages don't come out overnight. Lucky for you, it's possible to download the components separately, mash it all together and have it come out a working WAMP server!

The following howto is a guide helping you on your way with setting up Apache 2.2, PHP 5 and MySQL 5.0 on a Windows XP machine. Windows 2000 or newer works as well, Windows 98/ME will NOT (stick with Apache 1.3 for those). I tried to make it as detailed as possible without including screenshots of each step in the install process and adding 'click Next on this screen'.

Get the software

First, you'll need to download everything so you can install everything in one big swoop.
  • Apache 2.2 - the actual webserver. Select a mirror, then click the link for Win32 Binary (MSI Installer).
  • PHP 5 - the scripting language that will be the middle man between Apache and the MySQL database. Click the link for PHP 5.2.0 zip package (the installer does not have all extensions).
  • MySQL 5 - the database software. Click on 'MySQL Community Server', then click 'Select a mirror' for Windows (x86) ZIP/Setup.EXE. Skip past the form and click one of the HTTP links for a mirror close to your location.
  • phpMyAdmin - a PHP 'program' that allows you to configure MySQL. You could use the commandline programs that come with MySQL, but this is way easier. Click the link for english.zip.

IMPORTANT: If you plan on doing ANY kindof IP-based filtering in Apache, or use PHP for any kind of IP-based verification (with $_SERVER['REMOTE_ADDR']), do NOT get Apache v2.2.4!! There is a bug in this Apache version together with PHP 5 that makes it return 0.0.0.0 instead of the correct IP. This bug also affects any kind of IP address filtering with allow/deny in httpd.conf/.htaccess. Get Apache v2.2.3 instead, it works fine and does not have this bug.

Install everything

This is dead easy. Follow my lead.

Base directory: to keep things together, you might want to create a central folder where you're going to put everything. Preferably without spaces in the name. I chose to make C:\WAMP. If you prefer something else, substitute your path wherever it says C:\WAMP in the below steps.

Apache: Open the MSI installer file and click through the screens. Accept all the default settings until you reach the Destination Folder, where you will change it to C:\WAMP\Apache. If all goes well, you should be seeing a little Apache feather with a green icon in the system tray:

The Apache Monitor in the system tray
This is the Apache Service Monitor, which keeps an eye on the Apache process itself. It's handy for controlling Apache, but if you like, you can shut down the monitor without closing Apache itself.
Now go to http://localhost. If you get the message below, you did everything right.

It works!

PHP: Open the PHP install zip and extract everything to C:\WAMP\PHP. Make sure all the subdirectories are created.

PHP directory

MySQL: Open the MySQL install zip and double-click the Setup.exe file inside to start it. Pick the Custom install, then change the install path to C:\WAMP\MySQL. Let it install MySQL, skip the 'MySQL.com Sign-Up' and continue to configuring the MySQL server.
At the screen for 'default character set', select your best option.
At the screen for 'set security options', enter a root password.
Everywhere else, accept the default setting. Click Execute at the end to configure the MySQL server and you're done!

phpMyAdmin: Open the phpMyAdmin install zip and extract everything to C:\WAMP\Apache\htdocs. Make sure all the subdirectories are created. Open the install folder and rename the long-ass phpMyAdmin-2.x.x-english directory to pma.

phpMyAdmin directory

You now have four separate pieces of software installed! Next up: tieing everything together into a neat WAMP package.

Configuring

If you did everything correctly, Apache is already up and running. Now all we need to do is:
  1. Make Apache understand PHP
  2. Make PHP understand MySQL
  3. Make Apache understand MSQL
  4. Configure phpMyAdmin
Sounds easy? Well it's not really all that easy, but that's what this guide is for.

Step 1:

Find the file C:\WAMP\Apache\conf\httpd.conf and open it in Notepad (or whatever you prefer).

Find the section with all the LoadModule lines, and add this one to the bottom:
LoadModule php5_module "c:/WAMP/php/php5apache2_2.dll" (note: use forward slashes)
This makes Apache load the PHP module.

Next, find the line that starts with DirectoryIndex. Change it so it reads:
DirectoryIndex index.php index.html
This makes Apache understand index.php (default) files.

Now find the section with the AddType lines. Add these two:
AddType application/x-httpd-php .php .phtml .inc .php3
AddType application/x-httpd-php-source .phps

This makes Apache know what to do with the .php filetype.

Save the file and close it.
Next, go back to your C:\WAMP\PHP directory and do this:
  • Copy the php5ts.dll file to C:\WAMP\Apache\bin.
  • Copy the php.ini-recommended file to C:\WAMP\Apache.
  • Rename the file to php.ini.

The copied PHP.ini file

Open the php.ini file in Notepad, and change this line:
short_open_tag = Off
to:
short_open_tag = On
This allows for writing php using the short <? .. ?> tags.

While you're at it, change this line:
;session.save_path = "/tmp"
to:
session.save_path = "c:\windows\temp" (or wherever your temp folder is)
This lets PHP know where to store sessions.

Double-click the Apache icon in the system tray and click Restart to make Apache read the new configuration. Apache is now configured to understand PHP!

To test this, create C:\WAMP\Apache\htdocs\index.php. Then open it in Notepad and type <?phpinfo()?>. Save the file and close it.
Go back to http://localhost and refresh. If you see a boatload of PHP information, you did it!

phpinfo() demo

Step 2:

Now the next part is adding MySQL support to PHP.

Find the file C:\WAMP\Apache\php.ini and open it. Find the line:
extension_dir = "./"
and change it to:
extension_dir = "C:\WAMP\PHP\ext"
This lets Apache know where to find the MySQL extension for PHP.

Find the line:
;extension=php_mbstring.dll
and change it to:
extension=php_mbstring.dll
This loads the multi-byte string extension so phpMyAdmin can handle strings correctly.

Find the line:
;extension=php_mysql.dll
and change it to:
extension=php_mysql.dll
extension=php_mysqli.dll

This lets Apache load the two MySQL extensions from the PHP extension directory.

Save the file and close it. PHP is now configured to use MySQL!

Step 3:

All you need to do now is make Apache load MySQL. Easy enough!
Find the file:
C:\WAMP\MySQL\bin\libmySQL.dll
Copy it to:
C:\WAMP\Apache\bin\libmySQL.dll
This makes Apache load the MySQL library.

Go back to the Apache Service monitor again (double-click the icon in the system tray) and restart Apache once more to load all the new settings and libraries.

Step 4:

Now go to http://localhost/pma to load phpMyAdmin.
Since you haven't configured it yet, it can't access the MySQL database.

phpMyAdmin error screen

To do this:
  • Go to the C:\WAMP\Apache\htdocs\pma directory.
  • Rename the config.sample.inc.php file to config.inc.php.
  • Open the file in Notepad and find this line:
    $cfg['Servers'][$i]['auth_type'] = 'cookie';
  • Change it to:
    $cfg['Servers'][$i]['auth_type'] = 'config';
  • Below it, add this line:
    $cfg['Servers'][$i]['user'] = 'root';
  • Below that, add this line:
    $cfg['Servers'][$i]['password'] = 'your MySQL root password';
  • Find the line with controluser and delete the part pmauser between the quotes.
  • Find the line with controlpass and delete the part pmapass between the quotes.
  • Save the file and close it.
If you reload http://localhost/pma now, it should give you the main screen for phpMyAdmin.

phpMyAdmin main screen

You're done! Everything is setup now. Your WAMP server is finished!


Problems?

  • If you can't get to http://localhost, Apache isn't running. Go to Start > Run > services.msc, find Apache2 in the list and start it. If it's not in the list, reinstall Apache.
  • If Apache doesn't start, there is an error in the httpd.conf configuration file.
  • If no one can get to your webserver, make sure your firewall and/or router allows it.
  • Make sure you did everything correctly!

Tuesday, September 12, 2006

Beginner's Guide to Miranda Instant Messager

This post is about the multi-IM client Miranda. This is a very light-weight instant messaging client that can connect to a multitude of networks, offering a lot of features by means of plugins (think FireFox and its Extensions). I've been using it for a few years now and I am very satisfied with it. The amount of different plugins can be overwhelming for a new user, so I've decided to put together a little guide on the essentials.

Default Miranda interface

First off, get the bare client straight off the download page. And when I say bare, I don't really mean that: it includes the Miranda client itself, and plugins to get online with AIM, ICQ, MSN, IRC, Jabber/GoogleTalk and Yahoo. (A note on GoogleTalk on Miranda.) It also has a plugin to import contacts and history from ICQ. It should look something like the screenshot to the right when you first run it (though probably with more contacts in less groups). Skip ahead to the bottom of this post to see what my contact list looked like after everything was installed and configured.

The Options dialog is very, very complete - especially when you enable 'Show expert options'. You'll want to start at the Networks section, to fill out your account details for all IM networks you have an account on. The 'Status' menu in the main window allows you to set the status for each IM protocol independently, or all at once.

Now I know you're going to ask yourself: 'Is this it? A completely boring contact list with some icons?' and I know it looks pretty bland like this. Luckily, we can fix that! There are plugins for nearly everything you're used to in the regular IM clients. Installing plugins is really easy: you just grab it off the Addons page, unzip it, drop the dll (or two) in the 'Plugins' folder and restart Miranda. It loads right away and if it has options, it'll add a section to the Options dialog. Occasionally a plugin has a separate dll for icons, a smiley pack or documentation, which you can drop in folders 'Icons', 'Smileys' and 'Docs', respectively. Usually the Readme file included in the zip is helpful as well.
If adding a new plugin causes Miranda to start crashing, look for a Unicode version of the plugin (Windows 9x/ME uses ANSI versions, Windows 2000/XP and newer use Unicode versions) or a newer version. If both fail, hop on the Miranda forums, find the discussion thread for the crashing plugin and start reading. Most likely someone has the same problem and posted a solution or a workaround.

Modern Contact List (aka clist_modern)


This is the most dramatic change to your contact list that you will see. Download the Modern Contact List plugin to enable skins on your contact list, user avatars and other fun things. The default skin is pretty snazzy, and you can get even prettier ones from the Miranda website. Customizing an installed skin isn't that hard (Options > Customize > Skin), though you'll probably screw up once or twice trying to figure out what everything does (like me), so make a backup of your database first.

Other plugins that go with clist_modern nicely:
  • Loadavatars and Fingerprint
    Avatar Service (aka Loadavatars)
    This is a general avatar service to complement Miranda's own, which can be used by other plugins. By itself, it makes sure all your contacts' avatars are current and displayed on your contact list.
  • Fingerprint
    This plugin detects what IM client your contacts are using, as well as the client's version. Very cool. This goes together very well with mToolTip, described below.
  • Icon Library Manager (aka icolib)
    Another 'core' plugin that allows you to customize icons for pretty much everything.

tabSRMM


tabSRMM

The standard layout for the sending and receiving messages module (SRMM) is probably what you are used to: one window for each conversation or contact. If you have a lot of conversations at the same time (or just keep them open, like me), this will produce a lot of windows and clutter things up. The Tabbed SRMM plugin groups all conversations in one window, using tabs (again, think FireFox). The keyboard shortcut 'Esc' to close a conversation tab is especially great.

mToolTip


mToolTip

This one is not available on the Miranda website itself, but it's great: it creates a bubble tooltip with useful information when you hover the mouse cursor over someone in your contact list. The plugin itself is just the engine, so it still needs settings to create the tooltip content. It's a bit complex, but well worth the effort: get a mToolTip template from the Miranda website, then get the Database Editor++ to load the .ini file from the template. Detailed instructions on doing this are in the Readme file for the mToolTip preset.

Popup Plus


Popup Plus

Miss the popups that MSN Messenger creates on events like receiving a new email, getting an IM, seeing someone come online? Well, no fear: the Popup Plus plugin is here to save you. It will even notify you of people typing their first message to you (before the conversation window has opened), which is useful as well as good fun ('hey, how'd you know I was going to ask you something?').
This also alerts of you of new email on the protocols that support it.
Popup Plus email notification


SmileyAdd


SmileyAdd

I bet you REALLY miss this in conversations, huh? Well, just get the SmileyAdd plugin and all smileys you type or receive in messages will be converted to pictures. You can select to have each protocol use its own smiley pack, or have all use the same basic one. The only drawback is that MSN Messenger's custom smileys are not supported. (The MSN plugin itself seems to support them from Miranda 0.6.6 and up.)
SmileyAdd
For the MSN protocol, I'm using a smiley pack with the exact same smileys that MSN Messenger has, but unfortunately it's no longer available from the Miranda website: here it is.

Updater


Since Miranda is an open source project, updates will happen often. Very often. The Updater plugin can keep track of this, and if you put it on the most sensitive setting, don't be surprised when you get updates to some plugins several times per day. Put back the 'Update on .. change' setting a notch and you should be fine. The only thing it won't alert you to is new versions of the Miranda core engine itself - so you'll have to check for this periodically. I subscribed to the Miranda blog myself to keep an eye on this.

History++ 2in1


History++

To keep track of your messaging history, there is a default (embedded) plugin that logs all messages. This default is not very good, though - you can't see more than one message at a time and it's 'find' function can be a bit... dyslexic. The History++ plugin has a lot better features and gives you a much better overview. It tracks conversations as well.

Weather


Weather

Very useful if you want to know it the weather's going to be any good this week. It acts as a special protocol plugin, so you can add weather stations all over the world as contacts in your list, then group them together.

MyDetails


MyDetails

MSN Messenger has a frame at the top that shows your current avatar picture, your nick and your status. If you get the MyDetails plugin, Miranda can have this too! The plugin is still in developmental alpha stage, but it works very good. A bit of tweaking with the settings and you'll have it look very much like MSN Messenger. And this plugin works for all the other protocols as well! If they support avatars, you'll see them in the frame as well.

Final result


After I finished installing everything, tweaking my settings and got everything working, my contact list looks like the lower right picture. You can see the progress nicely when I install additional plugins.
Default layout
Default layout
Modern Contact List
Modern Contact List
  
Fingerprint
Fingerprint + Loadavatars
MyDetails
MyDetails


UPDATE: Since the implementation of the MSNP11 protocol for MSN, developers are starting to add features from the new MSN clients to Miranda. Nudge and ListeningTo (alpha stage) are among these. If you have Miranda 0.6 PR 2 or newer, you can add the 'listening to' information to the mTooltip settings. (You won't need the ListeningTo plugin for this.)

Add this to your mTooltip.ini:
[ListeningTo]
DBSub=MSN
DBSet=ListeningTo


Then add this somewhere in the MSN mTooltip setting (Options > mToolTip > Advanced > MSN) to show the info, if it is set by a contact:
%%Media: <b>(8) %user_ListeningTo|%%%%|</b>

ANOTHER UPDATE: Miranda 0.6.6 (in rapid succession to 0.6.5 and 0.6.4) was just released, and if you upgrade from 0.6.3 or earlier you'll find that Miranda can't find your profile anymore. You need to move the profile.dat file, see this thread on the Miranda forums.