With FastCGI & default PHP, if you have PHP display_errors turned off (which in production you should), your server will return a blank HTTP status Code 200 page, with no information to the end user as to what happened.
A new php.ini directive has been added with php-frm (Due to be incorporated into PHP Trunk in the near future)
How to correctly return a 500 Server Error Code rather than a blank 200
Either:
- Add to your main php.ini via eg /usr/local/lib/php.ini
- Or directly into the /etc/php-frm.conf
PHP.ini
fastcgi.error_header=”HTTP/1.1 500 Internal Server Error”
/etc/php-frm.conf
Add the directive below this line – <value name=”php_defines”>
<value name=”fastcgi.error_header”>HTTP/1.1 500 Internal Server Error</value>
Restart PHP-FRM (via /etc/init.d/php-frm)
So long as your server has either one of the following, you’ll see the effect immediately
- error_page 500 /50x.htm (In nginx)
- ErrorDocument 500 /50x.htm (In Apache)
Xdebug in PHP is speeding up my debuging of code. It allows me to backtrack through errors to see which function they were originally part of. As any web product grows it is sometimes difficult to diagnose where a function call was made that resulted in an error being generated.
Below is a snippet from my error log showing how, well ok, it’s because I used a == instead of an is_() function call.
[01-Mar-2010 08:52:19] PHP Notice: Undefined index: **VARIBLE*** in ***FILE1*** on line 342
[01-Mar-2010 08:52:19] PHP Stack trace:
[01-Mar-2010 08:52:19] PHP 1. {main}() ***FILE2***:0
[01-Mar-2010 08:52:19] PHP 2. ***FUNCTION1***() ***FILE2***:262
[01-Mar-2010 08:52:19] PHP 3. ***FUNCTION2*** ***FILE1***:223
TIP: Build Xdebug externally and call it in your php.ini file:-
zend_extension=”/FULL_PATH_TO/xdebug.so”
I have tried out APM (PHP Monitoring) but I could not get it to function correctly, however this may be due to conflict with xdebug.
Do you have any recommendations for PHP error log monitoring. Most of the products I have seen have not been worked on in months if not years and with the developments in PHP5.3 and the upcoming PHP6 I would like to have background monitoring and database insertion of errors. (A sexy AJAX interface would be great too!)
Review of Version Control Systems for Linux & Windows
This is a review article on my choice of revision (version) control software.
- I have never used a Version Control System
- Source code already in place
- I edit on Windows XP PC (although I used to develop on my Ubuntu Linux Laptop)
- The Should I Date.com runs Ubuntu 8.10 Server Edition
Current programming / testing methodology
- Editting the PHP files with Geany
- Test code locally using a VMWare image of Ubuntu (with a Shared Drive on the Windows machine linked to the httpdocs dir)
- Upload via SSH with WinSCP to Should I Date.com
This programming methodology has been used for the past couple of months as I prefer hand coding.
Now however with the code base now becoming more mature I am finding the need to do more performance testing and bug fixing on the code already in place. This has lead to a few situations where for example, the modification of my Database class can have a massive impact on the functionality of parts of the website that I may have wrote several months ago.
I therefore felt it was time to implement a version control system to allow me to quickly “jump back” should I make a mistake.
Control Systems evaluated
Subversion (SVN), Mercurial (HG), GIT & Ubuntu (Canonical) Bazaar (BZR).
I currently have installed TortoiseSVN on my Windows box and a requirement is at most 4 clicks to upload the code I have just updated. There are extensions for HG & SVN & Bazaar, GIT has a similar Windows shell extension.
SVN is by far the most difficult to setup with an existing project, after 20 minutes of fiddling with svn import file:///, coupled with the fact I had problems connecting with svn + ssh I gave up on SVN.
Git was much easier to set up and get working and was not selected purely on the lack of decent Windows client available
HG and Bzr are very similar in their implementation and I liked HG’s inotify plugin.
Bazaar (BZR) chosen
Bazaar was chosen mainly due to Bazaar Explorer, a cross platform BZR, diff, merge platform which easily allows you to add, remove files and directories from the tree, to commit and update your tree. It is very extensible however and easily allows you to choose your own editor, diff, merge external applications.
My only annoyance of Bzr is that it does not appear to do a remote update when you sync with the host tree, which is easy to implement with SVN.
The Should I Date.com Facebook Application is nearly complete, and just needs a Front Page to direct users to one or other of the sections, either
- Spread the Love – A mini app that allows people to pin love hearts on their and other people’s walls
- Group Photo Love – An app that downloads from Facebook photos with multiple people tagged in them.
I started developing these Facebook applications back in December as a natural progression from ShouldIDate.com and giving users a more instant gratification. I will be incorporating at some point full Should I Date.com functionality into this application but for now, it works
(ish)
It seems that PlentyofFish.com is trying another marketing campaign and linking up with the music industry again to promote itself as “happening”. POF has previously done this with a campaign Akon, including a video that was hastly withdrawn (most likely due to bandwidth issues). The competition clearly states US + Canada only once the user clicks through on a link, however, why as a UK citizen am I being shown this link as it is only a very basic check to determine the location of the user.
The following line in the Terms and Conditions is interesting. Fancy your face being on a billboard?
“Winners consent to the Contest Sponsors’ use of his/her name, city of residence, photograph, likeness, voice, statements and image for any publicity or programming purposes, in all media, without remuneration, throughout the world in perpetuity.”
Well hasn’t it been a while. I’ve been…. busy shall we say. This week represents the first time that I can sit a bit back from the product I’ve been working on and go “yea.. that looks good”. Can’t release tooo many details just yet, but suffice to say it’s going to be big… and…. For the first time…. I’ll truly be able to make my own direction. not just in business but … making a difference.
Things going well generally…. dating someone…. got a phone call asking for my consultancy services and… well… watch this video for a bit of an uplift!!
Argh!
I’m being eaten alive. No not some canabalistic experience, but by some small critters.
Amber my three year old cat, who is the world’s biggest whore friendliest cat ever, has recently “picked up” fleas and of course because she is adorable I sometimes let her into my bedroom. Maybe on second thoughts this might have been a mistake because now I’m being bitten, eaten alive by fleas those little bastards!!
I’ve now got about 10 whelts from the flea bites, but…. I’m fighting back. I’ve been spraying myself with flea spray, been going on a killing spree (letting the fleas jump onto me then splatting them), and the old favourite vacuuming every day (sort of).
All in all… this being eaten alive and all-out-warfare is a damn good workout!!
PlentyofFish.com now has a feature called “Date Night” which allows you to make yourself available for a date next Friday night. This facility is an interesting one as most of the single people on there are looking for a date leading to something more (like a long term relationship), although some enjoy the dating scene more than the idea of a fulfilling relationship.
So why have a feature on the website where you can “register” yourself as being available next weekend…. why not just have a little black book or a calendar where you can list yourself as FREE/ BUSY. Like an Outlook calendar. It would be good to have a calendar entry set to your Google Calendar or Outlook when you’ve arranged a date with someone, and then afterwards give feedback….. or whether you decided to run for the hills after!!!
Tags: dating, website review
Facebook has announced that in 3 days time you will be able to select your own username. Rather than the URL in the address bar showing profile.php?id=882010516 You wil beable to have www.facebook.com/rick.seymour (Being pre-emptive!).
Call me cynical but this will allow facebook to pull in more search engine results for an individuals name. I do hope that Google does not prioritise this or else you could have pages worth of useless content.
http://www.facebook.com/username/
12:01 a.m. EDT on Saturday, June 13. Is when Facebook’s Username registration (landgrabbing) will begin
Tags: website review
Why did the BNP do well at recent local and European elections? (From the recently published YouGov study into voting habits)
BNP voters tend to be totally turned off by politics and think that politicians are corrupt, for example 81% think their MP is corrupt compared to 48% of Labour voters. They have very specific reasons to vote BNP, which tends to be focused solely on immigration. BNP tend to take votes from skilled manual labour jobs. eg Plumbers & Electricians, which leans itself neatly to previous statement as immigration tends to be of semi-skilled and skilled people seeking more pay for their skills. BNP voters tend to usually vote Labour but would consider themselves more “right wing”, and appreciate the “self made working man”.
This demographic tends to be the hardest to convert but their likelihood to participate in the political system is the lowest, however if pushed they will come out. Therefore one must question the whole ideology behind the “Stop the BNP” campaigns as it appears to be these campaigns that actually motivate BNP voters to come out.
Legal Bit: All figures, unless otherwise stated, are from YouGov Plc. Total sample size was 32,268 adults. Fieldwork was undertaken between 29th May -4th June 2009. The survey was carried out online. The figures have been weighted and are representative of all GB adults (aged 18+).
Tags: voting