It’s been ages since I last wrote – I was ill again for some months and unable to update the site. I am now back to posting more often.

One of the big changes has been my decision to switch from MySQL to PostgreSQL. I will come back to the installation of this later, but suffice it to say it was not an easy ride given that I am running a compiled version of PHP.

 

There were several reasons:

  • PostgreSQL 9.1 (beta) supports Master/Slave replication and streaming natively with fallover. This is simply fantastic news for anyone running a high availability platform.
  • It is more future-proof especially in terms of scalability. I have read horror stories of production projects getting bigger then having to move to PostgreSQL etc.
  • I don’t trust Oracle to do right by MySQL. I already fear for Netbeans.
  • All the other normal reasons for PostgreSQL vs. MySQL
As I am using Nginx/Suhosin/PHP compiled (using Vlad’s guide) this also meant recompiling PHP to include the pgsql module. I did this by compiling PostgreSQL first, then adding –with pgsql to the PHP compile options. In both cases I would strongly recommend doing what I didn’t do first time, and reading installation instructions for both in their respective documentation.
You will also need to setup PostgreSQL with the recommended username of postgres. I didn’t the first time and it just led to more problems. PgAdmin III is a good windows interface to manage the database remotely, though it isn’t for the feint hearted, especially if you use SSH to connect to your server.
So, my overall setup is:
  • Ubunti 10.04 LTS
  • Nginx 1.04
  • PHP 5.3.5 with PHP-FPM, APC & Suhosin
  • PostgreSQL 9.1 Beta
I am still wrestling with the database design, mostly due to foreign key issues and getting a design that normalises. But, I am going ahead with some site coding in order to learn more about PostgreSQL with PHP.
If anyone has a similar setup I would love to hear how it works so I can compare.

EDIT: I have an edited script available now which installs all the above, plus sets up UFW and SSH for keygen only access. It is just a reworked version of Vlad’s script, but if it would save anyone time in installing I am happy to share it with you, just get in touch :)

No Comments on Jul 6th 2011

Many-to-many?? Oh noes!Any perfectionists out there? Paralysed revisionists? Or just plain indecisive? Well if you are any of these then don’t try database design! I think I’m a little bit of all three because I have just spent weeks trying to nail down my database design.

The difficulty is that once The Project ™ goes live, if there is an underlying fault in the logic, or missing bit of logic, this means changes to the database. If it’s not designed properly then it could mean major re-writes. So I have been plodding away trying to make the thing modular, open-ended and future-proof.

But, at some stage I have to finalise and I have set myself next week as a deadline for this. When it’s done I will post a diagram of what it looks like, minus a few labels so as I don’t give too much away! I think this must be as much an art form as a science, but I think it’s pretty much done and dusted.

In other news, I found out at last that my joint problems are due to something called “Fibromyalgia” The last couple of months has been about learning to adjust to a different regime as well as databases and the project! I don’t think it counts as good therapy, but I have started drinking coffee again to help with the fatigue, and discovered and amazing device… an Aeropress coffee maker! Go look it up on Amazon – it’s the best cup of coffee you will ever have!

No Comments on Dec 3rd 2010

It's all over!

I finally finished my dissertation this week! I had to finish my degree part-time due to working and the last couple of bits seem to have dragged on for centuries. For some reason, my writing only flows when I’m under pressure, I don’t know why, and coming close to the deadline I just found the words somehow. I still can’t believe it’s all over – huge weight off my mind (waking and sleeping)!

I can now finally relax and put all my time into The Project ™ ;) Expect lots of new stuff on php and general web application development as I get the back end for this working.

Company mugs etc on the way. It’s over! Wahey!

UPDATE: For anyone interested, I got a 2.1!

No Comments on Aug 27th 2010

Filed under games

Braid

Do you remember the first computer game that had you absolutely hooked? Well that’s what I think you will feel again if you play this game :) Braid is a production from an independant developer called Jonathan Blow.

Whether you are someone who never plays games, hates games, or a full-time gamer, I promise you will fall in love with this! The visuals are uniquely beatiful and the music… wow! Gameplay is something that just has to be experienced. If you like puzzles and want something to challenge, entertain and inspire you.. buy Braid – you will not be dissappointed.

At the moment it seems to be digital download only and I would recommend getting it on Steam, which I use for all my games. You might also want to read Eurogamer for a proper review :)

No Comments on Jul 16th 2010

It works! After much wailing and gnashing of teeth I finally got this lot to work together and can now debug my Zend Framework project remotely in Netbeans :) Firstly I should say what my setup is: Windows 7 x64 system for development using Netbeans 6.9, the webserver is Nginx running on Ubuntu 10.04 LTS on my Linode. I use SFTP to upload from Netbeans. The steps are as follows:

  1. Enable a port for debugging on the remote machine: UFW enable 9000 (I’m assuming that like me you have ports disabled by default on your remote server and enable what you need).
  2. Enable the same port on local router and map it to the debugging machine.
  3. Next we need to get the results of phpinfo from the server, which is simply a matter of putting a page up with the line phpinfo(). Cut and past this page (not the sourcecode!) to the xdebug wizard which you can find here
  4. This will give you instructions on how to install xdebug on your remote system. Before doing this though you may need to install phpdev in order to have phpize available: apt-get install php5-dev
  5. Edit your php.ini file, which in my case was at /etc/php5/cgi and add the following lines in addition to the line the xdebug wizard asks you to (note, I already have the zend_extension line specific to my server in here, you will want to use what the wizard suggests): picture of the xdebug changes for php.ini
  6. Restart your server or restart php + Nginx. If you just restart nginx it will not reload your php.ini! This took me nearly an hour to realize!
  7. In Netbeans you will need to update the run configuration for your zend framework project. This is an example of what mine looks like: picture of netbeans run configuration

I hope this is useful to someone else running into the same difficulties :) If you are contacting me about this article please be sure to google first for help! I have updated the Netbeans wiki on this, which is an excellent source of information. You might also want to read my post in the forums about getting zf working with Netbeans & xdebug (that was a a nightmare!)

3 Comments on Jul 1st 2010

The BeaitchHaving actually worked for Amazon in the past, as a customer service monkey on an email farm, I thought accessing their facilities would be… annoyingfruitless soul-destroying… less than perfect. I’m disappointed to say that it was actually really really easy. The Project ™ will require off-site data storage and I have to be sure it is accessible whenever I (my customers) want it. After much of my famous reading, I reckon this one is best. All data will be stored off-site, encrypted.

If you are reading this then you may want to take a look at their VPS on demand offerings… on demand by the hour. It’s a bidding system whereby you bid for a kernel to be up and doing your thing for x(hours). If the charge goes a certain amount over your bid then The Server shuts down when your agreed hours are over.

I think this is a great idea, but for “The Project” ™ I just need storage, and AWS S3 is just perfect for that :)

1 Comment on Jun 19th 2010

Well that was a suprise! I’ve only been with the company a few days and they gave us all a 42% RAM upgrade for their 7 year anniversary! The first thing I did was tweak MySql and use that extra RAM :) Very happy with Linode :)

No Comments on Jun 18th 2010

Google Apps IconAfter some messing around with the mail server I decided to move to Google Apps to provide the Mail for the site. There were many reasons for this. The first one was that it will free up my time due to not having to maintain a mail server. Also, the implementation of groups in the domain structure is great and fits in very well organisationally should this thing go commercial and we have staff. For the same reason the integrated, and shareable, calendar, documents and sites system also would save a lot of investment in bespoke systems for collaborating within an organisation. Most of all, it removes load from my servers and with a few CNAME changes puts it all googles way.

I made a few other decisions today. I am placing the customer support ticketing service and other customer facing aspects on another server. For now I am using my domain package with a well known hosting company. Better to have the two independant.

So, I have a fully functional organisational communication and collaboration system, along with a support system that feeds in to that. And it cost me… nothing! Now to get back to the code ;)

No Comments on Jun 18th 2010

What a nightmare!! Before you read any further I should say that I have managed to get these three things working together, but it wasn’t easy. For those interested in the more technical aspects of this, you can read how, with help, I managed to get this working by reading my post on the netbeans forum and checking the wiki on this subject, which I have updated.

I made the decision to go with Netbeans as an IDE as “The Project” will be a combination of a server based PHP module working from a fast changing database, a client based Java app for monitoring and many J2ME based clients running on mobile phones. Netbeans seems ideal for this and reportedly deals well with all three. Here is a diagram of what I am doing:

Diagram of The Project

Diagram of The Project

Netbeans is perfect for the Java parts of the system, but I wasn’t so sure initially of what to use for the PHP part. After reading some good reports on it as an IDE for PHP, I took the plunge and started working on a test Zend Framework module. It was then that I started running in to problems. Netbeans 6.9 RC2 is obviously a release candidate, but I would have expected them to have ironed out more problems by now. The difficulties were mostly to do with how netbeans interacts with the Zend Framework, specifically in registering as a provider, and it’s use of xdebug. Well I must have spent at least 100 hours on this, but with help we eventually figured everything out. If you are having problems with this I would recommend reading my post in full, and also check out the wiki, which I have updated. Hopefully the next release of Netbeans will make this process a whole lot smoother! I managed to get xdebug/Zend Framework working with both xampp and Zend Server CE, reliably. Don’t forget to set your project’s run parameters! ;)

No Comments on Jun 16th 2010

Linux, Apache, MySql and PHP. I was about to go ahead with this when I read about Apache being a resource hog. After much research I decided to go with Nginx (and Citadel as a mail server).

Firstly my choice of Nginx: though it leads to some compatibility problems the reduction in resource use was just too attractive to overlook. When “The Project” goes to production I want as little load on the server as possible and the system to be as simple as possible. The simpler a program is, the fewer the points of failure, the more reliable it will be. As this is going to be almost mission critical I want something that can take the pressure and not bog my server down. Nginx is renowned for dealing with heavy load effectively whilst generating little CPU and IO. Nginx was relatively easy to install with these instructions from Kjetil Jenson. A couple of things to be aware of when you are installing using this guide: if you have a fresh system then a couple of the dependencies for this process might be missing. I am using Ubuntu and in particular had to “get-apt install libltdl-dev” after getting the error “cannot find lltdl”. Also, make sure you have MySql server installed before you start – only the client seems to be installed by default.

I should also make it clear that I turned down Lighttpd after becoming concerned about the degree of compatibility with other systems, persistant talk of niggling errors and, most importantly of all, there were just too many reports of a memory leak that has been hard to pin down. As a programmer the ghost of a memory leak haunting my web server is enough to give me serious willies and I won’t touch it until I am reassured this is sorted.

Citadel mail server was more difficult. This mail server wil not be deployed in production as I will keep it on a separate server, but I do need something to help with the collaborative process in development. Although it looks a bit dated, especially with it’s old style, room based, bulletin board, it has a very functional groupware module which I find very useful. Citadel offers easy integration with Thunderbird and it’s calander add-on. It has a quirky interface and you may wish to be sure that your host name and hosts are set up correctly. Also, keep in mind that the FQDN in the server setting are what your initial email tail will be. The mail is user based, so you will need to add aliases for people in their user settings, rather than the conventional control-panel based idea of setting up new mailboxes and then adding aliases. It just doesn’t work like that. I am still playing with it to get to the bottom of how it deals with domains, so will probably check back here when I can say definitively how it does this. At present it seems quirky and I have not found the documentation particularly illuminating. It has internal HTTPS server which is great for accessing the web based interface and collaboration tools. This can be set to separate ports so that it does not interfere with Nginx. I haven’t looked at Postfix yet, but it would be my main choice of server if I had just required mail. I did look for other groupware software but the open-source offering out there at the moment seem pretty poor.

So, with hardly any wailing and gnashing of teeth, I have a working web server, mail/groupware server, PHP and MySql – perfect platform to get started on. Everything is open-source, thus keeping development costs to a minimum. For those wondering what this mysterious project is, I will write more on that later. I have to be careful as I don’t want divulge too much before it is ready to fly :)

No Comments on Jun 16th 2010

Older Posts »