reinierpost
reinierpost

Reputation: 8591

How can I unconditionally apply an auto_prepend in /etc/php.ini?

On our Apache server, it turns out that an auto_prepend_file specified in /etc/php.ini (and intended to be applied to all PHP files on the server) is disabled by any auto_prepend_file statement in .htaccess.

I am happy to allow auto_prepend_file statements in .htaccess, but in that case I still need the one in /etc/php.ini to take effect as well.

How to achieve this?

Upvotes: 1

Views: 343

Answers (1)

blue112
blue112

Reputation: 56522

What you can do is to specify inside your apache config a php_admin_value

From PHP.net:

Sets the value of the specified directive. This can not be used in .htaccess files. Any directive type set with php_admin_value can not be overridden by .htaccess or ini_set(). To clear a previously set value use none as the value.

php_admin_value auto_prepend_file "/path/to/your/file.php" 

This will prevent any user to override it from a .htaccess file. Since it's not possible to precise two paths, you won't be able to "add" a path from a htaccess, unfortunately.

Upvotes: 1

Related Questions