I used:
php_value auto_prepend_file \"file.php\"
in my .htaccess
that is in public_html
folder.
Now when
In your .htaccess
php_value auto_prepend_file /auto_prepend_file.php
php_value auto_append_file /auto_append_file.php
Next create 2 files in root
1) /auto_append_file.php
$appendFile = $_SERVER['DOCUMENT_ROOT'] . '/append.php';
require_once($appendFile);
2) /auto_prepend_file.php
$prependFile = $_SERVER['DOCUMENT_ROOT'] . '/prepend.php';
require_once($prependFile);
Now it should work on local and live servers irrespective of physical path or website providing each of your websites use the same filenames append.php and prepend.php.