Sonelal Singh
Sonelal Singh

Reputation: 69

auto_append_file giving error (internal server error)

I am appending two files in my .htaccess file and write these lines:

php_value auto_append_file begin_caching.php
php_value auto_append_file end_caching.php

But it giving me internal server error.

Upvotes: 0

Views: 391

Answers (2)

MarZab
MarZab

Reputation: 2658

Another alternative using .htaccess files is using AddHandler

.htaccess

AddHandler phptemplate .htm
AddHandler phptemplate .html
Action phptemplate /template.php

template.php

<?php

if (!isset($_SERVER['ORIG_PATH_INFO']))
    die('Error.');

readfile(ltrim($_SERVER['ORIG_PATH_INFO'], '/'));

?>

Upvotes: 0

hohner
hohner

Reputation: 11588

A lot of web hosts prohibit you using auto_prepend_file in .htaccess as a security measure, so this is probably why you're running into the 500 server error.

Why don't you just use this in your PHP file(s):

include 'begin_caching.php';

// Main PHP content

include 'end_caching.php';

Upvotes: 1

Related Questions