Configure Your Server To Parse HTML Files As PHP

When using a web application like FileChucker, you may want to embed it within another page on your site.  You can embed it within a .shtml page or a .php page, but what if you want to embed it within a plain old .html file?  Or you may be using UserBase to password-protect the pages on your website, and you'd rather not have to rename every page (and update every link) from a .html extension to a .php extension.

The solution is to configure the server to treat .html files like .php files; the server must parse the .html files just like it parses .php files.  If your server is Apache, then you can add a line to your website's top-level .htaccess file to enable this parsing.  The exact line that you must add to the .htaccess file will be different for different servers, depending on exactly how Apache and PHP are installed and configured.  But one of these lines (or sets of lines) should do it:

AddHandler x-httpd-php .html .htm
# (tested successfully on a GoDaddy/Apache server in December 2009)

AddHandler php-script .php .html .htm

AddHandler php5-script .php .html .htm

AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

To verify that it worked, create a file called phptest.html and put some PHP code into it; for example:

<?PHP
echo "PHP is working.";
?>

Now upload phptest.html to your server and visit it in your browser.  If it displays simply "PHP is working." then you're all set.  But if it displays all the PHP code ("echo", etc), or if it displays nothing at all, then you know it's not working, and you'll need to try different lines in your .htaccess file.

One final note: if your server has PHP's short-open-tag feature enabled, this may cause problems within any XML files on your site, since XML files start with "<?" which is what PHP uses as its short open tag.  The solution there is to disable the short open tags, either by adding this to your .htaccess file:

php_flag short_open_tag off

...or, on some servers, creating/editing a php.ini file within your website's top level, and putting this line into it:

short_open_tag = Off

Shopping Cart

Your cart is empty.

Client Quotes

You've done a wonderful job with FileChucker and UserBase, and they have made a big difference to how our website runs.
– Nicholas H.
I looked all over trying to find a simple cgi script.  I found that FileChucker was by far the best.  If you have issues with your hosting service's php.ini max upload size then this is the way to go.  Looking forward to future enhancements.
– Bob C.
The amount of customization in the program is incredible.  I was able to integrate it into my existing page layout relatively simply.  I was also able to easily customize the look/feel to match the current site.
– Jason M.