Zend Framework将SetEnv APPLICATION_ENV更改为“生产”会导致apache 500错误

时间:2010-12-30 15:04:41

标签: 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. 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>

htaccess的:

RewriteEngine On

RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
RewriteRule ^/*$ cached/index.html [L]

RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}\.html -f
RewriteRule .* cached/%{REQUEST_URI}\.html [L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

的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();

1 个答案:

答案 0 :(得分:2)

这段代码看起来对我很好 - 而且它会适用于非'生产'环境,我假设。

我会在configs / application.ini中查看确保你有一个[production]部分,有或没有':extends]部分。此外,将bootstrap()->run();包装在try / catch中,并生成并显示异常。至少在你调试过这个之前。