Installation Windows

This is a wiki version of my original document at http://mikenz.geek.nz/laconicawindowsinstall which is a bit prettier.

  • XHTML Version
  • PDF Version

– @mikenz

Installing XAMPP

Xampp is a nicely packaged version of Apache 2, PHP 5.2 and MySQL 5. It takes the time out of setting up these applications on Windows.

Download XAMPP from http://www.apachefriends.org/en/xampp-windows.html I’m using the XAMPP Lite package but the full one works fine too.

Extract it to somewhere, I extracted mine to c:\xampplite and will refer to files in that folder from now on. If you install is somewhere else then just remember that when reading this.

Run C:\xampplite\xampp-control and start Apache and MySQL. Go to http://localhost and you should see the XAMPP splash page. If so then XMAPP’s all ready to go.

Installing Darcs

I said this was setting up a development environment on Windows so we’re going to be using the development version of Laconica 🙂

“Darcs is a free, open source source code management system.” And is the version control system used for Laconica.

Download the “Just The Binary” version of of Darcs from here http://wiki.darcs.net/DarcsWiki/CategoryBinaries#head-c7910dd98302946c671cf63cb62712589b392074 Save this into a new folder called C:\xampplite\darcs.

As per the http://wiki.darcs.net/DarcsWiki/WindowsConfiguration intructions, Add C:\xampplite\darcs folder to the path (where Windows looks for programs).

  • Right click on ‘My Computer’ / ‘Computer’ on Vista.
  • Choose ‘Properties’.
  • Vista Only: Click on ‘Advanced system settings’ on the left.
  • Click the ‘Advanced’ tab.
  • Click ‘Environment variables’
  • Find the ‘PATH’ environment variable and choose to edit it.
  • Add ‘;C:\xampplite\darcs ‘ to the end of the ‘PATH’ environment variable.
  • Save and close the windows.

Open a Command Prompt and check Darcs is working:

Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\mikenz>darcs
darcs version 2.0.0 (2.0.0 (+ 19 patches))
Usage: darcs COMMAND ...

Checking out a copy of Laconica

Now that we have darcs we can get a copy of Laconica. Open up a comand prompt and go into the c:\xampplite\htdocs folder and get a copy of laconica with darcs . see below for the commands:

Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\mikenz>cd c:\xampplite\htdocs

c:\xampplite\htdocs>darcs get --partial http://laconi.ca/darcs/ laconica
Finished getting.

c:\xampplite\htdocs>

And you should end up with a copy of the Laconica in c:\xampplite\htdocs\laconica.

Laconica Prequisites

Laconica makes use of a number of other OpenSource? libraries.

PEAR Libraries

In the c:\xampplite\php\pear folder, delete every file and folder except “go-pear.phar”. Note that on some xampp installations, the pear directory is in capitals (PEAR), which caused me some troubles. I ended up with renaming this PEAR directory to pear all lower capitals.

c:\xampplite\htdocs>cd c:\xampplite\php\pear
c:\xampplite\php\pear>..\php go-pear.phar

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : 

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : c:\xampplite\php\pear
 2. Temporary directory for processing            : c:\xampplite\php\pear\tmp
 3. Temporary directory for downloads             : c:\xampplite\php\pear\tmp
 4. Binaries directory                            : c:\xampplite\php\pear
 5. PHP code directory ($php_dir)                 : c:\xampplite\php\pear\pear
 6. Documentation directory                       : c:\xampplite\php\pear\docs
 7. Data directory                                : c:\xampplite\php\pear\data
 8. User-modifiable configuration files directory : c:\xampplite\php\pear\cfg
 9. Public Web Files directory                    : c:\xampplite\php\pear\www
10. Tests directory                               : c:\xampplite\php\pear\tests
11. Name of configuration file                    : C:\Windows\pear.ini
12. Path to CLI php.exe                           : c:\xampplite\php\pear\

1-12, 'all' or Enter to continue: 12

Select the c:\xampplite\php folder in the popup

php.exe (sapi: cli) found.


Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : c:\xampplite\php\pear
 2. Temporary directory for processing            : c:\xampplite\php\pear\tmp
 3. Temporary directory for downloads             : c:\xampplite\php\pear\tmp
 4. Binaries directory                            : c:\xampplite\php\pear
 5. PHP code directory ($php_dir)                 : c:\xampplite\php\pear\pear
 6. Documentation directory                       : c:\xampplite\php\pear\docs
 7. Data directory                                : c:\xampplite\php\pear\data
 8. User-modifiable configuration files directory : c:\xampplite\php\pear\cfg
 9. Public Web Files directory                    : c:\xampplite\php\pear\www
10. Tests directory                               : c:\xampplite\php\pear\tests
11. Name of configuration file                    : C:\Windows\pear.ini
12. Path to CLI php.exe                           : C:\xampplite\php

1-12, 'all' or Enter to continue: 11
(Use $prefix as a shortcut for 'c:\xampplite\php\pear', etc.)
Name of configuration file [C:\Windows\pear.ini] : c:\xampplite\php\pear.ini

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : c:\xampplite\php\pear
 2. Temporary directory for processing            : c:\xampplite\php\pear\tmp
 3. Temporary directory for downloads             : c:\xampplite\php\pear\tmp
 4. Binaries directory                            : c:\xampplite\php\pear
 5. PHP code directory ($php_dir)                 : c:\xampplite\php\pear\pear
 6. Documentation directory                       : c:\xampplite\php\pear\docs
 7. Data directory                                : c:\xampplite\php\pear\data
 8. User-modifiable configuration files directory : c:\xampplite\php\pear\cfg
 9. Public Web Files directory                    : c:\xampplite\php\pear\www
10. Tests directory                               : c:\xampplite\php\pear\tests
11. Name of configuration file                    : c:\xampplite\php\pear.ini
12. Path to CLI php.exe                           : c:\xampplite\php\pear\

1-12, 'all' or Enter to continue: 
Beginning install...
Configuration written to c:\xampplite\php\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.7.1.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
install ok: channel://pear.php.net/Archive_Tar-1.3.2
install ok: channel://pear.php.net/Console_Getopt-1.2.3
install ok: channel://pear.php.net/Structures_Graph-1.0.2
install ok: channel://pear.php.net/PEAR-1.7.1
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<c:\xampplite\php\pear\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <C:\xampplite\php\php.ini>? [Y/n] : C:\xampplite\apache\bin\php.ini

Please look over your php.ini file to make sure
c:\xampplite\php\pear\pear is in your include_path.
Current include path           : .;\xampplite\php\pear\
Configured directory           : c:\xampplite\php\pear\pear
Currently used php.ini (guess) : C:\xampplite\php\php.ini
Press Enter to continue: 

** WARNING! Old version found at c:\xampplite\php\pear, please remove it or be sure to use the new c:\xampplite\php\pear\pear.bat command

The 'pear' command is now at your service at c:\xampplite\php\pear\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\xampplite\php\pear\pear.bat' until you have added
** 'c:\xampplite\php\pear' to your PATH environment variable.

Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.

For more information about PEAR, see:

  http://pear.php.net/faq.php
  http://pear.php.net/manual/

Thanks for using go-pear!



* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under c:\xampplite\php\pear\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.


c:\xampplite\php\pear>

Note that on the xampp installation, the php.ini file that is used is not on c:\\xampp\\php\php.ini but on C:\xampp\apache\bin\php.ini . Be sure to check phpinfo() to (http://127.0.0.1/xampp/phpinfo.php) to see where the actual file is located. You will probably have to manually add the line. This is documented above, but I read over it, it took me half an hour to figure it out.

include_path=".;c:\xampp\php\pear\pear;C:\xampp\php\pear\"

Now update PEAR.

c:\xampplite\php\pear>pear channel-update pear.php.net
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded

c:\xampplite\php\pear>pear upgrade-all
Will upgrade channel://pear.php.net/pear
Did not download optional dependencies: pear/XML_RPC, use --alldeps to download automatically
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
downloading PEAR-1.7.2.tgz ...
Starting to download PEAR-1.7.2.tgz (302,744 bytes)
....done: 302,744 bytes
upgrade-all ok: channel://pear.php.net/PEAR-1.7.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

c:\xampplite\php\pear>

Now that PEAR is installed, we need to install the PEAR libraries that Laconica uses.

c:\xampplite\php\pear>pear install db_dataobject
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
Did not download optional dependencies: pear/MDB2, pear/Validate, use --alldeps to download automatically
pear/DB_DataObject can optionally use package "pear/MDB2" (version >= 2.0.0RC1)
pear/DB_DataObject can optionally use package "pear/Validate" (version >= 0.1.1)
downloading DB_DataObject-1.8.8.tgz ...
Starting to download DB_DataObject-1.8.8.tgz (64,219 bytes)
....done: 64,219 bytes
downloading Date-1.4.7.tgz ...
Starting to download Date-1.4.7.tgz (55,754 bytes)
...done: 55,754 bytes
install ok: channel://pear.php.net/Date-1.4.7
install ok: channel://pear.php.net/DB_DataObject-1.8.8

c:\xampplite\php\pear>pear install validate-beta
downloading Validate-0.8.1.tgz ...
Starting to download Validate-0.8.1.tgz (19,588 bytes)
.......done: 19,588 bytes
install ok: channel://pear.php.net/Validate-0.8.1

c:\xampplite\php\pear>

Now Stop and Start Apache in the XAMPP Control Panel so it picks up the php.ini changes that the PEAR installer made.

XMPPHP

Create a folder called “ext” in the C:\xampplite\htdocs\laconica folder. This is where we will put other external code like XMPPHP.

Download the Featured Download from http://code.google.com/p/xmpphp/. Extract just the XMPPHP folder into C:\xampplite\htdocs\laconica\ext, so you now have a bunch of php files in C:\xampplite\htdocs\laconica\XMPPHP.

OAuth

Download http://oauth.googlecode.com/svn/code/php/OAuth.php and save it into the C:\xampplite\htdocs\laconica\ext folder.

php-openid

From http://openidenabled.com/ download “PHP OpenID Library” Version 2.1.1. Extract the Auth folder into C:\xampplite\htdocs\laconica\ext.

markdown

From http://michelf.com/projects/php-markdown/ download “PHP Markdown 1.0.1m”. Extract markdown.php into C:\xampplite\htdocs\laconica\ext.

Setting up a database

Go to http://127.0.0.1/phpmyadmin/ click “Privileges” then “Add a new User”.

Username: laconica

Host: localhost

Password: laconicapassword (feel free to use anything you like here)

Re-Type: laconicapassword

Database for user: “Create database with same name and grant all privileges”

“Go”

Now we have an empty database and a database user for Laconica. Next we need to create all the database tables.

Click “laconica” from the database list on the left. Then the “Import” tab at the top. Click “Browse” and select C:\xampplite\htdocs\laconica\db\laconica.sql then click “Go”. Now there should be a bunch of tables listed on the left hand side, the database is now all set.

Configuring Laconica

In C:\xampplite\htdocs\laconica make a copy of config.php.sample and call is config.php. Open this up and edit the values.

Tell it where we put extra stuff

$extra_path = array("C:/xampplite/htdocs/laconica/ext/");
set_include_path(implode(PATH_SEPARATOR, $extra_path) . PATH_SEPARATOR . get_include_path());

Give your site a name

$config['site']['name'] = 'Just another Laconica microblog';

Uncomment and customise any of these if you want to

#For contact email, defaults to $_SERVER["SERVER_ADMIN"]
#$config['site']['email'] = 'admin@example.net';
#Brought by...
#$config['site']['broughtby'] = 'Individual or Company';
#$config['site']['broughtbyurl'] = 'http://example.net/';

#Email info, used for SMS send. gmail example
$config['mail']['notifyfrom'] = 'username@gmail.com';
$config['mail']['domain'] = 'gmail.com';
# See http://pear.php.net/manual/en/package.mail.mail.factory.php for options
$config['mail']['backend'] = 'smtp';
$config['mail']['params'] = array('host' => 'ssl://smtp.gmail.com',
				  'port' => 465,
				  'auth' => true,
				  'username' => 'username@gmail.com',
				  'password' => 'password');
# for secure mail and xmpp you'll need to uncomment the extension=php_openssl.dll in your php.ini file  and restart your server.

Set the database options

$config['db']['database'] = 'mysql://laconica:laconicapassword@localhost/laconica';
$config['db']['ini_laconica'] = 'c:/xampplite/htdocs/laconica/stoica.ini';

Now go to http://localhost/laconica/ and you should have a microblog!

Fancy / Pretty Urls

http://localhost/laconica/main/register instead of http://localhost/laconica/index.php?action=register

Open C:\xampplite\htdocs\laconica\config.php and turn fancy urls on.

$config['site']['fancy'] = true;

In C:\xampplite\htdocs\laconica make a copy of “htaccess.sample” called “.htaccess” – this is tricky in Windows as it doesn’t like filenames starting with a dot. This can be done on the command line.

c:\xampplite>cd c:\xampplite\htdocs\laconica

c:\xampplite\htdocs\laconica>copy htaccess.sample ".htaccess"
        1 file(s) copied.

Edit .htaccess. And add an extra line near the top

RewriteEngine On
RewriteBase /laconica

RewriteRule ^$ index.php?action=public [L,QSA]

Apache in XAMPP comes with mod_rewrite disabled so we need to enable that too. Edit C:\xampplite\apache\conf\httpd.conf and uncomment this line 118

LoadModule rewrite_module modules/mod_rewrite.so

Stop and Start Apache again.

Now fancy urls like http://localhost/laconica/main/register will work.

XMPP / Jabber

You’ll need an account on a Jabber server for this.

Edit config.php again and uncomment the xmpp config options and enter the details for your jabber account that your site will use.

# xmpp
$config['xmpp']['enabled'] = true;
$config['xmpp']['server'] = 'jabber.example.net';
$config['xmpp']['port'] = 5222;
$config['xmpp']['user'] = 'microblog';
$config['xmpp']['resource'] = 'laconica';
$config['xmpp']['password'] = 'laconicapassword';

# xmpp using gtalk example
#$config['xmpp']['enabled'] = true;
#$config['xmpp']['host'] = 'talk.google.com';
#$config['xmpp']['server'] = 'gmail.com';
#$config['xmpp']['port'] = 5222;
#$config['xmpp']['user'] = 'username';
#$config['xmpp']['encryption'] = true;
#$config['xmpp']['resource'] = 'xmpphp';
#$config['xmpp']['password'] = 'password';
#$config['xmpp']['public'][] = 'username@gmail.com';

Login to your laconica installation and go to http://localhost/laconica/settings/im. Add the address of your server in your Jabber client if you haven’t already and them try adding your address.

If you get a lot of errors like this

Warning: stream_socket_enable_crypto() [http://localhost/laconica/settings/streams.crypto streams.crypto]: this stream does not support SSL/crypto in C:\xampplite\htdocs\laconica\ext\XMPPHP\XMPP.php on line 318

Then open up laconica\lib\jabber.php and at line 86 add a line to disable encryption. Note that this line number may change as development continues.

                $conn->autoSubscribe();
                $conn->useEncryption(false);

                if (!$conn) {
                        return false;
                }

Now try adding your IM again.

You should now have a message with a confirmation link. Clicking this should confirm your IM accpunt.

To be able to post notices using Jabber you’ll need to have the xmppdaemon.php running the whole time. Here’s how to make a batch file so it’s easy to start.

In C:\xampplite\htdocs\laconica create a new text file called “xmppdaemon.bat” and open it for editing. Add these two lines to it, and save it.

cd C:\xampplite\htdocs\laconica

c:\xampplite\php\php -c c:\xampplite\apache\bin\php.ini C:\xampplite\htdocs\laconica\xmppdaemon.php

Double click xmppdaemon.bat and it will open. Just leave the box open, a bunch off errors will probably scroll past . don’t worry about them.

Now you should be able to send messages to the Jabber account you configured and they’ll show up in your microblog.

SMS

Sorry, too hard to do on Windows . get a real server with a decent OS.