[ACCEPTED]-Set path to php.ini-php

Accepted answer
Score: 13

Add this to your server configuration...

PHPINIDir /path/to/new/php_ini

Make 3 sure to just include the path to the directory, not 2 the entire path to the file.

Then restart 1 Apache.

Check it worked with phpinfo().

Score: 3

Have a look at .user.ini section at the php docs.

Since 10 PHP 5.3.0, PHP includes support for .htaccess-style 9 INI files on a per-directory basis.

But 8 beside the .unser.ini solution you can place 7 an additional ini file in the "additional 6 .ini files parsed" directory. There 5 you can use one single ini file to overwrite 4 all other settings. Name it with zzz at 3 the beginning and it will be parsed at last. This 2 is also easy for your hoster to deploy without 1 destroying his settings.

Score: 1

Kolink, I suspect that you are on a shared 12 hosting service, in which case your host 11 may be using something called suPHP. In 10 this case -- as you describe -- the PHPINIDir 9 directive doesn't work, in which case there 8 is a suPHP_ConfigPath directive.

In terms of access, I 7 have a standard mod_rewrite in my DOCROOT/.htaccess:

RewriteEngine   On
RewriteBase     /
# if a forbidden directory or file name (starting with a . or /) then raise 404 Fatal
RewriteRule (^|/)[_.] -         [F]

What 6 this does is forbid any request for any 5 filename or directory prefixed by . or _. I 4 have a DOCROOT/_private where I keep this stuff for me:

suPHP_ConfigPath DOCROOT/_private

where 3 you will need to replace DOCROOT by your 2 local setting on your service. Look for 1 DOCUMENT_ROOT in a phpinfo() listing.

More Related questions