I used:
php_value auto_prepend_file "file.php"
in my .htaccess that is in public_html folder.
Now when I run public_html/sub/index.php i get this error :
Fatal error: Unknown: Failed opening required 'file.php'
How to use auto_prepend_file flag to include a file relative to .htaccess file ?
The file must be inside PHP’s
include_path. So you must either set the file’s directory to be in theinclude_pathinside php.ini, or do it in the .htaccess with aphp_valuestatement.If you use the above method in .htaccess, be sure to copy the
include_pathfrom php.ini in and add the:/path_to/file_directoryso you don’t lose any already needed includes.Alternatively, just add
:/path/to/file_directorytoinclude_pathdirectly in the php.iniUpdate
If you cannot modify the include_path, you might try specifying a relative path to the
auto_prepend_file. This should work since the file path sent is processed identically as if it was called withrequire():