Category Archives: Web Programming


PHP Storm File Association

Jetbrains PHP Storm is an IDE that I love, the biggest pain about using it is that the uninstaller/installer when you upgrade from one version to the next puts the installation into a new folder, and it causes your files such as .php or .tpl to no longer associate with the phpstorm.exe file. Further, because of this you cannot associate them in the Windows -> open with -> choose default program dialogue as Windows simply will not put the program in the recommended programs or other programs list.

There are three workarounds for this that I am aware of, two of which I have tried successfully. I plan on trying the third way the next time I run an update of PHP Storm.

  1. Download a program that will automatically look for broken program associations. This one worked for me, and it cleaned up my PC a bit too:
  2. Edit the registry. This is actually the quickest and easiest way:
    • Click on Start Menu
    • In search box type in ‘regedit’
    • Back up your registry ( )
    • Navigate to: Computer\HKEY_CLASSES_ROOT\Applications (not the .application one!!!)
    • Scroll down to PhpStorm.exe
    • Expand it to shell -> open -> command and you will see the folder that it opens under
    • Compare this to the new install of PHP Storm. If different:
    • Right-Click on the PhpStorm.exe in the registry editor and click on delete
    • Go back to the file you want associated with PHP Storm, Right-Click and select ‘open with’ – ‘choose default program…’
    • Ensure ‘Always use the selected program to open this kind of file’ and click ‘Browse’
    • Navigate to JetBrains -> PhpStorm 6.0 (or whatever folder Number) -> bin -> PhpStorm.exe
    • Program will now show up in the list of programs for other file types as well
  3. The final method involves the directory to which you install PHP Storm, and I haven’t yet tried this method. You should probably rename the install folder to simply ‘PHPStorm’ and not have a version number beside it, and always install into that folder. I have read that this method works, and I will be trying it next time I upgrade.

Hope this helps.

WordPress Permalinks web.config File Creation when there is a Permissions Error

When attempting to enable permalinks in Wordprss, you may come across the following message at the top of the settings-permalinks page after selecting a common settings style:

You should update your web.config now

Followed by this message below the ‘Save Changes’ button:

If the root directory of your site were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Create a new file, called web.config in the root directory of your site. Click in the field and press CTRL + a to select all. Then insert this code into the web.config file.

All this means is that the root directory for your site is not writable, and WordPress has just attempted unsuccessfully to create the new file called web.config. This is a good thing, and means that the root folder permissions on your server are at a more secure setting.

To get permalinks working, follow the steps outlined above or:

  1. Open notepad (windows)
  2. Copy and paste the code block from WordPress into the new notepad document
  3. Click File -> Save
  4. Select ‘All Files (*.*) from the Save as type drop-down menu
  5. Type in ‘web.config’ and remove the .txt
  6. FTP this file to the root folder

One last thing, click on ‘Save Changes’ in WordPress after selecting the type of permalinks you want. A Second message will appear:

If your web.config file were writable, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules> element in web.config file.

Ignore this message, permalinks will already be working. Visit you blog and click on a post heading to see the permalinks in action!

This is current as of WordPress 3.3.1.

How to properly apply Mobile Browser Telephone Number Detection

While building a mobile browser website today, I came across a strange problem on my iPhone. I was building a real estate website which had the clients phone number on the page, and it had listing addresses which if they were of the right length (7 or more digits) Safari was converting them to phone number links.

Here is the original code, first is the telephone number, second is the address:

<div id="call-portrait">555-123-4567</div>
<p>111-1234 Main Street Vancouver, BC</p>

A quick search for how to disable telephone number detection in mobile browsers offered me the following meta-tags (first one is for iOS/iPhone, second is for Blackberry):

<meta name="format-detection" content="telephone=no">
<meta http-equiv="x-rim-auto-match" content="none">

After I applied this code addresses were no longer links, but neither was the clients’ telephone number. Further searching turned up an HTML method of inserting telephone numbers into code that I was not aware of which is similar to the mailto format:

<a href="tel:555-123-4567">555-123-4567</a>

So wrapping text or an image inside to that tag turns the telephone number into a usable link. The one drawback, not that it seems to be a real problem as there are already telephone number harvesters out there, is that this method provides a more efficient way for said harvesters to obtain phone numbers from your website.