2013-06-03 48 views
3

我想在多個域上運行Zend Framework。在1域我有整個應用程序與2個不同的application.ini每個域的一個。 在其他域我只複製公用文件夾。但我似乎無法得到第二個域在index.php中運行,希望你們能幫助我。Zend Framework在多個域上

<?php 
header("Content-type: text/html; charset=utf-8"); 
// Define path to application directory 
defined('APPLICATION_PATH') 
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../DOMAIN_WITH_APPLICATION_MAP/application')); 

// Define application environment 
defined('APPLICATION_ENV') 
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development')); 

// Ensure library/ is on include_path 
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../../DOMAIN_WITH_APPLICATION_MAP/library'), 
    get_include_path(), 
))); 

/** Zend_Application */ 
require_once 'Zend/Application.php'; 

require_once 'Zend/Loader/Autoloader.php'; 
$loader = Zend_Loader_Autoloader::getInstance(); 
$loader->setFallbackAutoloader (true); 
$loader->suppressNotFoundWarnings (false); 

// Create application, bootstrap, and run 
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application2.ini' 
); 
$application->bootstrap() 
      ->run(); 
+0

你的vhost配置是什麼樣的? –

回答

0

您需要更新服務器配置。如果您使用的是Apache,您將需要使用ServerAlias,這將允許您將主域中的內容映射到別名域。例如:

<VirtualHost *:80> 
    ServerName www.mysite.co.uk 
    ServerAlias www.mysite2.co.uk www.mysite3.co.uk 
</VirtualHost>