Custom php.ini per-directory (for testing sites)

I'm running Apache 2.26, on Windows 7 with PHP 5.39 mod_ssl/2.2.6 OpenSSL/0.9.8g .

PHP works fine, so does Apache.

However, I want to try and create custom php.ini files per directory, for my test sites.

I could - and did - use php_flag but would like to try to create a custom php.ini file that works. I tried to Google this, but couldn't find anything relevant.

This is my current .htaccess for C:/www/vhosts/localhost/testsite1:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

#RewriteCond %{REQUEST_fileNAME} !\.php -f
#RewriteRule .* index.php

AddType text/html .asp
AddHandler application/x-httpd-php .page

php_value include_path "./php:/php/"

Yet, I made a change in the custom php.ini within the php to have short tags off [for testing only] but it didn't pick it up, the php code showed instead.

Any help is appreciated with this; it'll be extremely useful!

(bear in mind, this Apache install is a development/testing one)


If you are using php_flag then you are probably using mod_php5. Custom 'php.ini' files aren't supported with this. You would need to use suPHP or equiv as the php.ini is only loaded at PHP startup, and this isn't per-request for mod_php5 and FCGI.

However, since you are using PHP 5.3 you can also use .user.ini files which are parsed on a per-request basis.

Need Your Help

Making a Form Fieldset text smaller after choosing an option

javascript jquery html css

i'm new to Javascript and Jquery and i am trying to create a kind of questionnaire style page.

Using a thread in C++ to report progress of computations

c++ unix pthreads

I'm writing a generic abstract class to be able to report on the status of as many instance variables as we need. For instance, consider the following useless loop: