Archive for the ‘Life: Work and Techy’ category

PHP: PHP Programming on Windows using JetBrains PhpStorm and local PHP

October 12th, 2011

Here’s some steps which may help somebody else install PHP on their Windows machine to run alongside JetBrain’s PhpStorm for PHPUnit testing

  • Download Windows PHP from http://windows.php.net/download/ . I selected PHP 5.3.8 ‘s VC9 x86 Thread Safe (2011-Aug-23 12:01:10) Installer.
  • Install, with no web server configurations, to C:\Program Files (x86)\PHP
  • Download the appropriate APC module from http://downloads.php.net/pierre/ to match your PHP version. I picked: http://downloads.php.net/pierre/php_apc-3.1.5-5.3-vc9-x86.zip
  • Copy the enclosed php_apc.dll from that .zip file to C:\program files\x86\PHP\ext
  • Download the appropriate XDebug module from http://xdebug.org/download.php to match your PHP version. I picked: http://xdebug.org/files/php_xdebug-2.1.2-5.3-vc9.dll
  • Save the file to c:\program files\x96\PHP\ext (I had to save it as c:\users\richyc and then, from my administrator command prompt (see below) do “cp c:\users\richyc\php_xdebug-2.1.2-5.3-vc9.dll.dll “c:\program files (x86)\php\ext”)
  • Start a command prompt, cmd.exe, with administration rights (Windows->Search->cmd.exe right click and then “Run as administrator”)
  • In the command prompt, enter the following:
    cd “c:\program files (x86)\php\pear”
    php go-pear.phar
    Are you install a system-wide PEAR or a local copy? system
    Accept all defaults
    pear upgrade pear
    pear config-set auto_discover 1
    pecl channel-update pecl.php.net
    pecl config-set php_suffix .exe
    pecl install channel://pecl.php.net/dbus-0.1.1
    pear install channel://pear.php.net/HTTP_REQUEST2-2.0.0RC2 channel://pear.php.net/Net_URL2-0.3.1 pear/XML_RPC2
    pear install pear.phpunit.de/PHPUnit phpunit/DbUnit phpunit/PHPUnit_Selenium phpunit/PHPUnit_Story phpunit/PHP_Invoker
    echo extension = php_apc.dll >> ../php.ini
    echo zend_extension = “C:\program files (x86)\php\ext\php_xdebug-2.1.2-5.3-vc9.dll” >> ../php.ini
    echo xdebug.remote_enable=1 >> ../php.ini
    echo xdebug.remote_host=localhost >> ../php.ini
    echo xdebug.remote_port=9000 >> ../php.ini
    echo date.timezone = “Etc/UTC” >> ../php.ini
  • To test from the command prompt, just try php -m. You should see apc and xdebug (twice) listed.

Now PHP is configured, we need to configure JetBrain’s PHPStorm to use it:

  • Load PHPStorm
  • Open or create your project
  • Go to File->Settings->PHP
  • In the PHP home section, enter: C:\Program Files (x86)\PHP and select “Xdebug” as your debugger
  • Select “Update include paths”
  • Select PHP->Debug->Xdebug proxy
  • Enter Host: localhost and port: 9000. Leave “IDE Key” empty

Varnish: Unable to start: SHMFILE owned by running…

September 15th, 2011

If, when trying to start the Varnish reverse proxy server, you receive an error message such as:
[root@internet634.fbi.gov ]#/usr/sbin/varnishd -d -f /etc/varnish/default.vcl
GeoIP plugin loaded successfully.
storage_file: filename: ./varnish.8QhQpI size 4208 MB.
SHMFILE owned by running varnishd master (pid=2451)
(Use unique -n arguments if you want multiple instances.)

but “ps auxwww | grep 2451″ doesn’t show Varnish (in my case, it was dkim-milter on that pid) and “ps auxwww | grep varnish” shows nothing, then you need to manually reset Varnish’s SHMFILE settings.

This is easier done than said! Just go into /var/lib/varnish/[hostname] and delete all the files in there (such as varnish.8QhQPI and _.vsl). Restarting varnish should then be successful.

UK Post code Lookup prices compared

March 19th, 2011

Following on from my Voice Over IP Call Costs Compared post, I’m now looking at differing costs of looking up UK Postcodes.

Prices exclude VAT and are based on a single UK Premises address level lookup on a public facing website and buying the smallest credit pack possible for the number of lookups.

Company Price per lookup Minimum purchase Credit length
200 lookups 500 lookups 1,000 lookups 2,000 lookups 5,000 lookups
Postcode Software £0.0300 £0.0300 £0.0176 £0.0176 £0.0176 500 lookups
£15
12 months
Crafty Clicks
Pay as you go
£0.0300 £0.0300 £0.0300 £0.0300 £0.0200 300 lookups
£9
12 months
Crafty Clicks
Monthly plan
£0.0175 £0.0150 £0.0150 £0.0150 £0.0125 250 lookups
£4.38
1 month
Postcode Anywhere £0.0500 £0.0500 £0.0500 £0.0400 £0.3300 1000 lookups
£50
12 months

UK VoIP Call Costs Compared

February 13th, 2011

As you might have seen from my recent tweets, I’m looking at changing my VoIP provider (I started off on Gradwell’s Multi User package, moved to VoipFone (which never really “worked right” with my setup) then moved to AAISP), as AAISP don’t currently offer all the facilities I would like (the most important one being sending the “number being called” as the CLI when forwarding VoIP calls to my mobile). But which one to go to? Well, after two long calls to o2 mobiles today, I started to look at call costs as well as the “monthly rates” – and here’s the details of the VoIP call costs and “line rentals” which may be of use to people:

Provider Monthly rate for 01/02 number Monthly rate for 03333 number Peak to o2 mobile Weekend to o2 mobile Peak to 01/02/03 numbers Weekend to 01/02/03 numbers
Gradwell Single User £4.00 £4.00 9.00ppm 6.00ppm 1.25ppm 1.00ppm
Gradwell Multi User £8.00 £8.00 9.00ppm 6.00ppm 1.25ppm 1.00ppm
AAISP £1.00 £1.00 18.33ppm 18.33ppm 1.25ppm 0.83ppm
VoipFone £2.00 £2.00 12.00ppm 12.00ppm 1.00ppm 1.00ppm
Soho66 £2.00 £2.00 10.00ppm 10.00ppm 1.00ppm 0.50ppm
VoIPTalk Standard Tariff £2.99 £2.99 11.90ppm 11.90pm 1.40ppm 1.40ppm
VoIPTalk Prepay Silver Package £6.98 £6.98 9.90ppm 7.90pm 1.00ppm 1.00ppm
DrayTEL Standard Tariff £2.99 £2.99 11.90ppm 11.90pm 1.40ppm 1.40ppm
Sipgate None Not offered 9.90ppm 9.90ppm 1.19ppm 1.19ppm
AQL £2.00 £2.00 7.10ppm 7.2ppm 1.00ppm 0.80ppm

All prices subject to VAT, prices may vary yadda yadda yadda. In otherwords, these are the prices I found when I looked – the prices you might be charged and might find may be different.

Correction: 14 Feb 2011 13:41: Previously AAISP’s prices were shown including VAT. This has now been fixed.

Request Tracker (RT) and Google Apps

June 23rd, 2010

If you are trying to setup Best Practical’s Request Tracker (RT) system (originally written by Jesse Vincent, but I more associate Dave Rolsky with it), to work with a Google Apps hosted domain (so you have Google Mail/Gmail for your domain), you may find the following useful.

  1. First of all, install “rt” on your Linux box and install “fetchmail” using your package manager if it isn’t already installed
  2. Setup an email account something like “support@” or “rt@” (I’ll use “rt@” in these examples) in Google Apps. Make a note of the password you set
  3. In /opt/rt3/etc/RT_SiteConfig.pm (if you used the default install location), you’ll need to set the following:
    Set( $RTAddressRegexp,'^rt(\+[a-z]+)?\@example\.com$');
  4. Do the basic configuration of “rt” and make your queues – I made the following queues:
    Queue name Reply address Comment address
    Backend rt+backend@example.com rt+backendcomments@example.com
    Frontend rt+frontend@example.com rt+frontendcomments@example.com
    Billing rt+billing@example.com rt+billingcomments@example.com
    General rt@example.com rt+comments@example.com
  5. Log into your new Google Apps Gmail account with the details you created and agree to the terms of service etc
  6. Click on “Settings” and “Filters” and create a series of filters such as:
    • To: rt+backend@example.com [Next step]
    • Skip the Inbox (Archive it)
    • Apply the label: backend
    • Never send it to Spam [Create filter]
    • To: rt+backendcomments@example.com [Next step]
    • Skip the Inbox (Archive it)
    • Apply the label: backend-comments
    • Never send it to Spam [Create filter]
  7. For the “general” queue’s “Reply” address (rt@example.com), do not setup a filter
  8. Once done, on your Linux server where you have installed the Request Tracker, edit /etc/fetchmailrc to read similar to:

    set daemon 60
    set invisible
    set no bouncemail
    set no syslog
    set logfile /var/log/fetchmail
    poll imap.gmail.com
    proto IMAP service 993 user rt@example.com pass PA55W0RD
    folder Inbox ssl
    mda "/opt/rt3/bin/rt-mailgate --url http://rt.example.com/ --queue General --action correspond"
    poll imap.gmail.com
    proto IMAP service 993 user rt@example.com pass PA55W0RD
    folder general-comments ssl
    mda "/opt/rt3/bin/rt-mailgate --url http://rt.example.com/ --queue General --action comments"

    poll imap.gmail.com
    proto IMAP service 993 user rt@example.com pass PA55W0RD
    folder backend ssl
    mda "/opt/rt3/bin/rt-mailgate --url http://rt.example.com/ --queue Backend --action correspond"
    poll imap.gmail.com
    proto IMAP service 993 user rt@example.com pass PA55W0RD
    folder backend-comments ssl
    mda "/opt/rt3/bin/rt-mailgate --url http://rt.example.com/ --queue Backend --action comments"

    Of course changing rt@example.com to the email account you created, PA55W0RD to the password set for that email account, http://rt.example.com to the location of your Request Tracker installation (it has to be accessible from the server you are creating this file on), the “folder” name to correspond with the label you set for that queue and comments, etc and repeating for as many queues as you have.

  9. Save the file and start fetchmail using /sbin/service fetchmail start or your Linux distribution’s service starter
  10. Watch the log file using tail -f /var/log/fetchmail

    And that should be RT up and running with Google Apps for you!

gamy-dance