How to add new file extension to parse php code?

28 03 2011

For some reason if you need to enable a new file extension rather than .php to parse your php code, then this article will help you. But before you proceed, i would like to warn you an issue. If you enable other file extensions like .html to parse php code, every time an html file is requested, it is passed to php for parsing. It may have an issue with performance. However, if you need to enable more extensions to parse php code, then continue reading.

The process is very simple, all you need is to add the specified extension in your apache configuration file, which is httpd.conf . So you need to locate the file. Open the file and find the line –

AddType application/x-httpd-php .php

If its not there, add the line and then add your desired extension after .php separated by space –
AddType application/x-httpd-php .php .html

Finally restart apache server. This way you can add other extensions. What it does is, it binds a MIME type to a particular extension.

Advertisements




Fix “apache2: Could not reliably determine the server’s fully qualified domain name” problem in Ubuntu

13 05 2010

I was suffering with the problem “apache2: Could not reliably determine the server’s fully qualified domain name” recently and it was frustrating. At first i was unable to figure out the problem and after some search on google i have found a solution which seems very simple. So lets see how to fix this problem-

Open your terminal and type-
sudo gedit /etc/apache2/httpd.conf
This will open httpd.conf file which is blank by default. Now add the following line to this file-
ServerName localhost
Save the file. That’s all you need to do. Now you can restart the server-
sudo /etc/init.d/apache2 restart