Tuesday, May 26, 2009

PHP & IIS - INI File Location

OK, so normally I wouldn't be seen dead running PHP on Windows but I'm currently doing some odds and ends for MiCandidate and one of the things they needed was to run some PHP code in their otherwise ASP.NET based site.

One of the ASP.NET developers attempted to install the current release of PHP (5.2.9-2), first from the MSI and then using the ZIP package but in the end failed to get their customised php.ini file to load.

After a less than delightful morning of reading and testing, I have discovered the following. The phpinfo() function will apparantly always return a value of 'c:\windows' for the configuration file path setting.

The important thing to note here though is where the ini file is being loaded from. By default it will load it from the PHP installation directory. If you want to to load from somewhere else, like say, the windows directory, you must first edit the registry and add/change the following key:


setting its value to 'c:\windows\'

However, this is not enough to force PHP to load this file. You must also ensure that you have removed any copy of php.ini from the installation directory too before the registry setting is respected.

It is also worthwhile noting that you need to ensure that your PHPRC environmental variable is set to your PHP installation folder (usually c:\php).

Finally, it is a good idea to set up a separate application pool in IIS to run PHP so you can just recyle that to see the changes made in php.ini. This obviously minimises distrutpion for other developers using the server.

This experience did nothing to enamor the ASP.NET developer to PHP and I wonder why the MSI installer can not take care of these issues gracefully.

Friday, May 22, 2009

Tip for Irish Companies & Professionals on Twitter - Brand it!

Anyone who has taken the time to look at Twitter can not fail to be struck by its potential for humanising business and the marketing opportunities inherent therein - (FreelanceWebDev).

One thing that has surprised me though, is how little work organisations and professionals in Ireland have put into their branding there. Even those in the business of offering branding as part of their service and those who's main interface with their market IS the web, seem to fall short in this regard. When you look at the efforts kids put into the look and feel of their Bebo profiles you start to realise the increasing importance of this aspect of your presentation.

Successful look and feel branding on Twitter means you need to respect a few constraints in the layout of the pages and you should note how those change for various screen resolutions but even designing for the most common resolution currently of 1024 x 800 will have a big impact on the perception of your Twitter page.

Monday, May 18, 2009

JQuery Plugin nyroModal and Base HREF

I've been using JQuery on my new pet project (excuse the pun) and having tried a few of the modal content plugins available, I have settled on NyroModal, a very compact, flexible and elegant solution.

Yesterday though, I ran into a small issue with the plugin. I am using a base href tag on the site so that I can use URL rewriting but still use relative links in my content. When trying to load a hidden div as the content of a modal, I discovered that because the base href URL is being prepended to the URL NyroModal attempts to load, NyroModal assumes that I am requesting another page rather than an element in the page DOM. The result is a modal displaying a 'content not found' error.

My first thought on discovering this was to remove the base href element from the page in the click event of the link spawning the modal before calling the modal but that didn't work as JQuery removes the element from the DOM but still retains it internally.

I also had no luck removing the value of the href attribute before calling the modal but checking in the NyroModal script, the original URL in the base href was still being used.

Given at that point that I was already looking into the NyroModal script to see what URL was being passed I decided to dig a little deeper and found a rather simple solution.

The script has a line

if(req == currLoc)

This line basically checks if the requested URL (stripped of the specific selector) matches the href property of the current location object to see if the URL is the same as the current page and therefore that it should be loading a DOM element from the current page. However, because the pressence of the base href attribute, it's value gets prepended to the requested URL and this comparison becomes invalid. Amending this check to also compare against the value of the base href attribute as follows addresses this issue.

if(req == currLoc || req == $('base').attr('href'))

I have posted about this on the issue thread for the NyroModal project on Google code.

Saturday, May 16, 2009

.htaccess and PHP4 Vs. PHP5 on Blacknight Shared Hosting

Ah, another weekend and another foray into troubleshooting issues with my recently acquired Blacknight hosting. For the past few weeks I had been using PHP4 but decided today that I should really move to PHP5 for my new personal project.

After some head scratching, it seems that I can not override the display_errors setting in the pho.ini file for PHP5 which by default is set to Off via the .htaccess file though I can do this for PHP4. However, I can override it by using ini_set() within my scripts.

This information might come in handy for some other poor soul wondering why they were getting blank screens. I will have to investigate at some point what options I have for overriding other settings as it is nice to keep all these things centralised.

Friday, May 15, 2009

Irish Email Marketing - What Not to Do

I have just been spammed at my personal email address by the popular Irish insurance website, 123.ie. I really have to wonder what goes through the minds of those involved in the production of these mailouts risking the integrity of their entire list by including addresses they shouldn't.

To the best of my knowledge, I have never given any email address to this site. The email I received was image based so did not render in my email client properly - I had to enable the images in order to discover how to unsubscribe to mailings I never actually knowingly subscribed to. This only increased my sense of privacy violation as it is likely that these image impressions are being tracked.

In any case I followed the remove instructions trusting that they will be honoured - if not, I will be sitting on the data protection regulator to address this meaningfully. I also marked the email as spam in my Gmail which hopefully will have some negative impact on future mailouts by 123.ie.

Irish email spam is relatively rare and I for one, intend to keep it that way :)

Tuesday, May 12, 2009

3 Roam Like Home - R.I.P.?

Reading on Boards.ie that the telco 3 is to axe its 3 like home service which basically meant that a 3 customer was charged abroad exactly as they would be at home for voice and data as long as they roamed on another 3 network.

One of the reasons being proffered for this move is the new reduced EU roaming rates which will, allegedly, deprive 3 of the revenue to support this service. In essence it makes a mockery of the EU roaming charges legislation by suggesting that it has introduced new charges for 3 customers where none previously existed.

I would imagine that the spirit of that legislation was that the telcos should desist from their previous unjustifiable profit taking on customers who travel and it seems from this consumers point of view, a pretty cynical move to just reclassify those charges to maintain profit margins rather than absorbing the reduction in revenue.

While officially 3 Ireland have denied that any changes are coming in this area, it is hard to believe they won't follow the lead of their British and Italian counterparts. To stay in line with their sister networks abroad who are ceasing the service on June 30th and honour their legal obligation to give 30 days notice, they will have to come clean by the end of the month.

I would call COMREG and ask what they think of this if I thought they cared or had the teeth to do anything about it but given that it took the EU, rather than our own regulator to take on the telcos in this regard in the first place, I wouldn't be hopeful of any meaningful response.

TinyMCE & Tables The Easy Way

I am a big fan of the open source CMS ModX which uses the rich text editor TinyMCE by default. While, like most developers, I have moved away for table based layouts for my sites, there are times when the CMS users need to enter tabulated data and doing this is somewhat less than user friendly.

Working on my latest ModX based site for a mutltilingual recruitment agency this morning I've come across this issue as I enter tabulated international salary data. The tables are not complex, we have a header row containing column headings and a number of rows containing data. However, in the table code automatically produced by TinyMCE, it does not distinguish between header rows using table heading tags but rather just produces regular rows.

I have discovered that the easiest way to add and format these tables for non-technical users to TinyMCE is to lay them out in MS Excel and then copy and paste the cells comprising the table into TinyMCE. A user can then add the general table class by right clicking the table in the editor and entering the table class and by placing the cursor in a cell in the heading row and right clicking, choose 'Row Properties' and apply a heading row class.

The specific CSS classes I am using for this project are below. This gives a table with a blue heading with white text and individual cells are bordered in the same blue. Of course, these styles can easily be customised for your own site look & feel.

/* I give the data tables their own class to distinguish them for other content that may be tabulated in the content or layout.*/
border:1px solid #3525CD;
table.datatable tr.header
/* The header row class for my table */

Friday, May 8, 2009

Irish Broadcasting Bill 2009

There is an interesting article and discussion going on at Slashdot on the current Broadcasting Bill wending its way through the system here. Essentially it would seem that under the new legislation, owning an internet connected multimedia PC would be enough to trigger the requirement to pay a TV license.

I can see the need for such legislation amending the licensing law to cater for all the new modes of accessing the state broadcaster's content which don't involve a TV (Slingbox being my personal favourite) but only if we persist with this arcane licensing system, conceived in a very different era.

It is difficult to see any justification any more for actually having this discrete licensing system with all the overhead of administration and enforcement, not to mention all the debates about value for money and where it leaves the commercial broadcasters in terms of competition.

All in all it seems a missed opportunity to reexamine this whole area and apply some fresh thinking.

GMail Out Sick

So this morning I logged into my iGoogle page only to discover that, as written about it several blogs the past few days that the GMail gadget no longer works as I have the 'use https' setting switched on in my GMail.

So as directed I then tried to visit GMail directly at www.gmail.com (using both a http and https connection) and got:

It seems that POP3 access is down at the moment too.

Doesn't seem that long since GMail's last outage. Given that GMail is such a fundamental part of iGoogle, it strikes me as odd that the services seem so fractured and that this issue of https should ever see the light of day and given that it is all Google real estate at the end of the day, it would be a nice idea if the status of the resolution to these outages appeared on my iGoogle page.

No mention yet of the current outage on the official GMail blog.

Tuesday, May 5, 2009

No Shared PEAR Library on Blacknight Minimus :(

I've just got a mail from the Technical Director at Blacknight pointing me to a post regarding PEAR availability on their shared hosting packages. However, it seems I am still having issues with the paths I was given for PEAR originally so am awaiting clarification.
End of Update

Update 2
Just got a mail from frontline tech support pointing me at the original paths. Not overly helpful given I have just pointed out, they don't seem to work.
End of Update

So this long weekend I was busy getting up and running on Blacknight where I've taken out a Minimus hosting package to evaluate their service using my current personal project Lost & Found Pets Ireland after continued very disappointing service from my current main shared hosting provider Namesco (formally Register365).

All was going nicely as I configured my site using their very clear and intuitive control panel, I uploaded my site, set up and imported my database, set folder permissions and configured the email services with no real problem. However, I quickly realised that not everything in the garden was rosy. I use the excellent Pear library to abstract my database interactions and after quite a bit of experimentation and several emails to support I learned that while for PHP4, there is an accessible shared version of Pear, it does not include MDB2 and there is no accessible shared installation of Pear for PHP5.

Getting the paths to Pear for both versions of PHP took a couple of emails and at that point it would have been nice if they could have told me that the PHP5 version wasn't accessible due to open-basedirectory restrictions never mind that the PHP4 version didn't have MDB2 installed. After quite a few mails I established that they did not see prospects for making Pear more available which is pity and means my search for a replacement to Namesco for the majority of my shared hosting still continues. With increasingly complex demands being made on even more basic sites it is a great pity that Blacknight have taken this position given the quality of PEAR and how much it speeds up development time. They had no difficulty with me installing my own copy though for me, that's just one more headache as I have to monitor versions and particularly security issues now - tasks I feel should really be in Blacknight's domain.

I spent the best part of 2 hours on Sunday massaging the web based installer to get a working copy of PEAR with MDb2 and the MySQL driver installed. While the Pear installer ran without issue and installed MDB2 in the root of my webspace, the big problem came when I tried to install the MySQL driver as all the folders Pear created during installation were only read only to me and the web installer didn't have the correct version of the MySQL driver to match the version of MDB2 it installs so a manual install was required.

After a couple of tries I eventually figured out that I had to create all folders created by the Pear installer myself first to guarantee ownership and then install PEAR with the MDB2 option enabled and then manually install the corresponding MySQL driver. A time expenditure I could really have done without.

This doesn't leave me much hope of installing other really useful PEAR modules like Mail or XML-RPC and my search for a small developer friendly host continues...