faqts : Computers : Programming : Languages : PHP : kms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 15 people (93%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How I can run php script if the file extension is not .php / .htm?

Dec 23rd, 2004 10:24
Matthew Wilkinson, Deric Tse,


If you are using an Apache server, and you can use .htaccess files if
you are hosted, or have access to httpd.conf, you can easily make any
extension run as a PHP script. All you need to do is somewhere in either
file add the line:
AddType application/x-httpd-php (extension)
For example, I use several of these for my website:
AddType application/x-httpd-php cnst
AddType application/x-httpd-php func
AddType application/x-httpd-php block
AddType application/x-httpd-php thm
AddType application/x-httpd-php mod
AddType application/x-httpd-php admin
Any file with those extensions will run as a PHP Script.
Final Note: If you add any lines to httpd.conf, remember to restart your
Apache Server so that the changes take effect.