Why do I get an error when trying to use the php_value/php_admin_value directives in .htaccess files?
Posted by Support, Last modified by Support on 08 November 2012 03:47 PM
Why do I get an error when trying to use the php_value or php_admin_value directives in .htaccess files?

For security we use suPHP on our linux servers. suPHP does not support the php_value/php_admin_value directive known by mod_php to parse configuration options to scripts for certain virtual hosts or directories. Since suPHP does not see PHP configurations in .htaccess files, the work around is you need to move these settings into the PHP script itself, using the PHP ini_set() function. For example,
  • change php_flag register_globals On in .htaccess to ini_set("register_globals", "On"); in your PHP script.
  • change php_value include_path "dir1:dir2" in .htaccess to ini_set("include_path", "dir1:dir2"); in your PHP script.

Another option you can do in PHP 5.3 and higher, is to add the name value pairs you would normally put into the php.ini file, into a file in the html folder called .user.ini. This will override the php.ini values as you require.

(464 vote(s))
Helpful
Not helpful

Comments (0)