Hello,

I run multiple domains/sites on my linux and windows server. I know there is a php.ini files that comes with the php installation package. But I have heard that there is a way to create a local php.ini file for each domain.

Does anyone knows how to create local php.ini files for each domain. Is there a special setting i need to do to make it run?


Thanx for your help

PS - I use cPanel on my linux server and Plesk on my windows server.

Hi there.

You can set php configuration options with ini_set() in every page. There is a limitation I think that with this command you cannot load extensions.

I don't know about Linux, but this is how it can be done on Windows :

httpd.conf :

Include conf/php.conf

php.conf

# PHP Definitions for Apache

# Load PHP Module & Associate .php extensions

#PHP 5
PHPIniDir "C:/web/Apache/conf"
LoadModule php5_module c:/web/PHP/php5apache2_2.dll
AddType application/x-httpd-php .php

# PHP Test & Help Sites
Alias /php "C:/web/webs/php"
Alias /phpmanual "C:/web/PHP/html"

DirectoryIndex index.php index.html index.html.var

Form PHPIniDir will php.ini loaded after restart.

On the other hand :

httpd.conf :

Include conf/sites/*.conf

In sites for example we've got test1.conf :

Alias /test1 C:/web/webs/test1
<Directory "C:/web/webs/test1">
   Order Deny,Allow
   [B]php_flag[/B] register_globals off
</Directory>

//

You can use specific apache directives in httpd.conf or .htaccess :

php_value name value

php_flag name on|off

php_admin_value name value

php_admin_flag name on|off


//

With this you have different configuration options for different directories.


- Mitko Kostov

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.