Thursday, 14 October 2010

Websiting

This morning I checked my email, which I had quite a bit of due to not being able to check it most of yesterday.

After that I looked into fixing the cyan shift caused by the UV IR filter, and found a program called CornerFix. Unfortunately it didn't recognise my camera and so didn't work, so I sent a message to the developer hoping they can update it.

I did some more website work, still looking at getting nginx and php-fpm up and running so that I can get the country a user comes from (using the geo-ip module for nginx).

In the afternoon I went to help someone with their computer for a bit, then did some more website work. I was having trouble with the PERL5LIB environment variable not being loaded into my bash session on Ubuntu, despite it being specified in my ~/.bash_profile. After trying a few things I gave google a try and found this helpful thread: Do I put PATH in bash_profile or bashrc or both?.

It turns out the problem is that in Ubuntu when you open a terminal session, it loads ~/.bashrc and not ~/.bash_profile. So to fix this, in terminal go to 'Edit' and then 'Profiles...'. In the window that opens click on 'Edit', then in the new window that opens go to the 'Title and Command' tab. Under the 'Command' section of this tab click 'Run command as login shell'. Close the two windows and close the terminal. Now if you open terminal again, it should ~/.bash_profile

When L got home from school we started watching Batman and Robin, then finished watching it after dinner. In the evening I did some more website stuff. First I was trying to figure out how to (let nginx) log serious php errors and exceptions without displaying error messages on screen, then I found that I had multiple php processes running thanks to my cron job.

The cron job just tries to start the nginx, mysql, and php processes every 15 minutes or so, expecting that if they are already running they will just say so and won't start a new instance. Unfortunately it seems that the php-fpm init script that ships with php doesn't include this logic (why should it?) and so I ended up with new php processes being started each time the cron job called the php-fpm init script.

So I modified the php-fpm init script to only start a new process if the php-fpm pid file doesn't exist. Not a great solution, if the server / php crash, it would probably leave the pid file so the edited script would think php was running when it isn't. I will try and improve it tomorrow.

No comments: