Monthly Archives: August 2010

Change PHP Mapping for .php File Extension

Applies to: PHP, Apache

Let’s imagine your apache webhost has both PHP4 and PHP5 installed, and the default mapping for .php files is linked to PHP4. Now the question is, how do you change that mapping to get PHP5 linked to .php files? (assuming you don’t have administrative priviledges on the webhost)

Workaround: You may choose to simply name your php files with the .php5 file extension if there are only a few scripts that require PHP5 (not really the answer to our problem).

Solution: If you don’t want to rename all your scripts to .php5, create a .htaccess file (or edit the existing .htaccess file, if you already have one). You can create this file using a text editor such as Notepad, WordPad, vi, nano, etc. and place the following line in the text file:

AddType x-mapp-php5 .php

Save the text file as .htaccess in the folder where you need to use PHP5 (or upload the file to the correct folder). The settings specified in the .htaccess file are recursive meaning that the settings will apply to the current folder where the file is saved as well as all subfolders.

Have fun! :-)

Display entries in Windows DNS cache

Applies to: Windows

DNS search results are cached on local systems to prevent a lookup every time the search is required. Sometimes during troubleshooting it is helpful to see the contents of the DNS client cache. This recipe describes the process of viewing the Windows DNS cache.

To view the DNS cache on the local system, type the following command from a command prompt:

ipconfig /displaydns | more

The | more is optional and will pause the output after each screenful which may be helpful since the DNS cache can get large and the output format uses several lines per record.

A sample output from this command is shown below. This is an address lookup for the host The Record Name and A (Host) Record lines show the request and answer. The Time To Live field shows the number of seconds before this entry expires.
Record Name . . . . . :
Record Type . . . . . : 1
Time To Live  . . . . : 3597
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . :