Zend framework Zend Framework将SetEnv应用程序“u ENV”更改为;生产";导致apache 500错误

Zend framework Zend Framework将SetEnv应用程序“u ENV”更改为;生产";导致apache 500错误,zend-framework,Zend Framework,当我将APPLICATION_ENV更改为“production”并重新启动apache时,我得到一个500错误。当它开始发展时,我没有问题。我完全生气了。有什么建议吗?配置文件如下 httpd-vhosts.conf # # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Mo

当我将APPLICATION_ENV更改为“production”并重新启动apache时,我得到一个500错误。当它开始发展时,我没有问题。我完全生气了。有什么建议吗?配置文件如下

httpd-vhosts.conf

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
NameVirtualHost *:443
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:443>

    SSLEngine On
    SSLCertificateFile "C:\Program Files\Zend\Apache2\conf\ssl\star.crt"
    SSLCertificateKeyFile "C:\Program Files\Zend\Apache2\conf\ssl\star.key"


    ServerAdmin postmaster@dummy-host.localhost
    DocumentRoot "C:\Sidekick\public"
    ServerName *
    ServerAlias *

    <Directory "C:\Sidekick\public">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all

        SetEnv APPLICATION_ENV development
    </Directory>

    ErrorLog "logs/dummy-host.localhost-error.log"
    CustomLog "logs/dummy-host.localhost-access.log" combined
</VirtualHost>
index.php

<?php

// Define path to application directory
defined('APPLICATION_PATH')
 || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

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

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

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

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

在我看来,这段代码还可以——我认为它适用于非“生产”环境


我会查看configs/application.ini,以确保您有一个[production]部分,有没有“:extends]”部分。另外,包装
bootstrap()->run()在try/catch中,生成并显示异常。至少在你调试完之前。

谢谢!试捕是一个很大的帮助。出于某种原因,我在application.ini文件的“开发”部分中有resources.view[]=而不是production部分。使用
[dev:production]
可以获得相同的信息,但会覆盖dev所需的内容。
<?php

// Define path to application directory
defined('APPLICATION_PATH')
 || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

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

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

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

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