I recommend that one use PHP 4.3.X or at least 4.2.X when using IsmoCore and hence also when using IsmoBlog. However Sourceforge only have version 4.1.2 installed. But I wanted to set up a example installation of IsmoBlog there so I went to work.
First I needed PEAR because even if some parts of PEAR were installed, actually I didn’t even check, I’m sure they would be too old versions for what IsmoCore requires. So I went to pear.php.net and checked the installation instructions because I’ve never installed PEAR separately before as I always compile PHP by hand myself. Installing PEAR is simple, all that’s needed is to run
$ lynx -source http://go-pear.org | php
in a shell and then answer the questions and give the path to where one wants the installer to install the files.
After that had finished I had to install the packages IsmoCore requires (they are mentioned in IsmoCore’s installation instructions) and then I installed IsmoCore and IsmoDB. I also added
at the top of IsmoBlog’s do.php file so that it will find my custom PEAR installation. Ok, that was the PEAR packages…
IsmoBlog uses Smarty which is not available as a PEAR package. So I went and downloaded the latest version and put it in a good location.
Now it was time to configure IsmoBlog.
$ mv Configuration.tmpl.php Configuration.php $ vim Configuration.php
After that I tried to run the installation script (php install.php) but do you think it worked? Of course not. I had forgotten to change one import statement to use ismodb.db instead of ismocore.db when I splitted IsmoDB out into its own package but even correcting that didn’t help much.
The mysql database at SourceForge isn’t running on localhost and IsmoBlog cannot currently be configured to use a database on another host. Damn, so I had to add a DATABASE_HOST configuration directive and change relevant parts of the code to honor it. When that was one I could finally complete the installation.
With a bit of anticipation I tried to access my new IsmoBlog installation and I was greeted with an error page. IsmoDB is currently using the array_change_key_case method in one place and it was added in PHP 4.2.0 so it isn’t available in SourceForge’s PHP version. But after a short search in the PHP manual I found anlar at hotmail dot com’s PHP implementation of that function and I added that to IsmoDB.
I could now access the IsmoBlog installation but there were no blog entries, of course. So I tried to login to add one, only to notice a weird problem.
I could sometimes login but after being redirected to the admin page I got sent back to the login page again. So the admin page didn’t think that I was logged in even though the login page approved of my credentials and forwarded me to the admin section.
I added some echo() and print_r() statements, the best debugging tools 🙂 and I noticed that the session was lost but not all the time only sometimes. It went in a pattern, if I reloaded the admin page I would get the debugging output four times in a row (so the session wasn’t found) and then get the real admin page two times in a row (so the session was found) and then it would start over again.
This left me very perplexed. I couldn’t understand how the session sometimes was found and sometimes not. But when looking through the session section of the PHP manual I noticed the session.save_path configuration option and got an idea.
What if there are more than one apache server and some requests go to for example server A and the other requests to server B. And what if a session on server A can’t be found on server B? I guess session.save_path should be set up to a NFS shared directory by default but maybe it isn’t on SourceForge or maybe there is something wrong with it. I thought it was worth trying to change the session.save_path setting and see what happened.
And guess what? It started to work! So for some reason the PHP sessions are not shared between all SourceForge’s apache servers using their configuration. Quite crappy if you ask me but maybe there’s a reason for it.
So now IsmoBlog was working on SourceForge and I was writing the first entry. But I noticed a weird escaping problem of ‘, ” and \ characters and I thought it was weird that I hadn’t noticed it on morrdusk. But after some phpinfo():ing I noticed that magic_quotes_gpc was enabled on SourceForge.
I don’t remember changing the value of that setting on morrdusk, so maybe the defaults were different in the PHP 4.1.X era. Anyways, adding
php_value magic_quotes_gpc 0
to the .htaccess file fixed that problem and IsmoBlog is now running on SourceForge.
The conclusion is that I found some problems with IsmoBlog’s current configuration alternatives which I will fix and I will also add the missing function to IsmoDB. After this the Ismo tools should work fine with PHP 4.1.X even though I still recommend the use of a newer PHP version.