The most straight forward that I can see would be to always prepend a php
file that does the appropriate ini_set's based on $_SERVER['HTTP_HOST'] or
$_SERVER['SERVER_NAME'].  For example:


::::: your php.ini :::::
include_path = ".;c:\php\includes"
auto_prepend_file = setup_vhost.php


::::: c:\php\includes\setup_vhost.php :::::
$settingFile = 'vhosts/'.$_SERVER['HTTP_HOST'].'php';
if (file_exists($settingFile)) {
  $settings = parse_ini_file('vhosts/'.$_SERVER['HTTP_HOST']);
  foreach($settings as $setting=>$value) {
    ini_set($setting, $value);
  }// foreach
}// if


::::: vhosts/www.host1.com.php :::::
; <?php exit; ?>  # this line is here to make sure nothing happens if
executed
smtp = host1domain.com
sendmail_from = [EMAIL PROTECTED]


::::: vhosts/www.host2.com.php :::::
; <?php exit; ?>  # this line is here to make sure nothing happens if
executed
smtp = host2domain.com
sendmail_from = [EMAIL PROTECTED]



of course, you could pull the data from a db and make the logic in
setup_vhost more complex; but you should get the point from this simplified
example.



> -----Original Message-----
> From: James [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 29, 2004 8:27 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Virtual Hosts - How to Configure
> 
> 
> I am setting up apache/php on a windows box as a test, and 
> would like to know how to set up php so that each virtual 
> host has their own smtp / mailserver settings.  As I 
> understand the config now, they will share the settings in 
> the php.ini file located in the windows folder.  Is there an 
> alternate or additional config that would allow virtual host 
> (1) have smtp = host1domain.com and virtual host (2) have 
> smtp = host2domain.com?
> 
> Any help is appreciated.
> 
> 
> James
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to