开发者

Zend Framework Changing SetEnv APPLICATION_ENV to "production" causes apache 500 error

When I change APPLICATION_ENV to "production" and restart apache I get a 500 error. When it's set to development I have no problems. I'm completely miffed. Any suggestions? Config files are below

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


That code looks OK to me - and it would be working for a non-'production' environment, I'd assume.

I would look in configs/application.ini to make sure you had a [production] section, with or without the ': extends]' part. Also, wrap the bootstrap()->run(); in a try/catch, and have the exception generated, and displayed. at least till you've debugged this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜