eHow launches Android app: Get the best of eHow on the go.

How To

How to Run a PHP File Without a .Php Extension

Contributor
By Jeffrey Ober
eHow Contributing Writer
(0 Ratings)

When PHP is installed and set up on a web server, an association will be created between files that end with the letters "php" and the PHP processor program. In order to allow the PHP processor to accept files that do not end with the file extension php, a line needs to be added to the .htaccess file that controls how files are associated with applications. Adding one line will allow you to associate any file ending with your PHP processor.

Difficulty: Challenging
Instructions
  1. Step 1

    Open your .htaccess file for editing. This file will be in the same directory as your web files that you want to use. If the file does not exist, you can create it using any plain text editor.

  2. Step 2

    Add a line to the .htaccess file as follows:
    AddHandler x-httpd-php .xxx
    Replace the xxx in that line with the file extension you want to use for your php files.

  3. Step 3

    Save the .htaccess file.

  4. Step 4

    Re-start your web server. All files with the .xxx ending that you provided that are accessed through the web server will now be processed through the PHP processor before being delivered by the web server.

Tips & Warnings
  • When you add the line in your .htaccess file, capitalization matters. If you need to create the .htaccess file, be sure the file name begins with a period or this will not work.
  • Be careful associating other named file extensions to the php engine--you can create instances where the wrong files will be processed by the PHP engine, causing garbled output on your web server.

References

Post a Comment

Post a Comment
  • Have you done this? Click here to let us know.
I Did This

Related Ads

Internet
Virginia DeBolt,

Meet Virginia DeBolt eHow's Internet Expert.

Get Free Internet Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Demand Media
eHow_eHow Technology and Electronics