Question

In my .htaccess file

php_value auto_append_file "run_me_first.php"

Because I want to run it first before any other file. Now it works if run_me_first.php and foo.php are in the same directory but once I do something like going in a directory, it gives me this error (include_path='.:/usr/share/php:/usr/share/pear')

root
|_ .htaccess
|_ run_me_first.php
|_ foo.php
|_ folder1
   |_ bar.php // If I try to access this, give me the error above.

Any idea?

Was it helpful?

Solution

You can set the full path linking to your root folder, to make your rule directory-recursive. You can see the path on your cPanel, or using php function getcwd() in run_me_first.php.

In my case the path would be like this:

php_value auto_append_file "/home/userID/public_html/run_me_first.php"

Note: If you want to prepend file(in this case your appending the file to the end of every file), use auto_prepend_file instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top