我已经设置了一个暂存环境(uat)。目的是重定向所有电子邮件到一个单一的电子邮件地址或最坏的情况下禁用电子邮件功能。我的问题是,尽管设置如下,应用程序仍在发送电子邮件,因为它应该在prod环境中。
# config_uat.yml
imports:
- { resource: config.yml }
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
swiftmailer:
transport: smtp
host: 127.0.0.1
port: 25
encryption: null
sender_address: info@gpsc.cwtwebpem.com
logging: "%kernel.debug%"
delivery_address: 'bastien@vial-collet.fr'
disable_delivery: true以及:
#config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: "@psmdbBundle/Resources/config/services.yml" }
- { resource: "@psmdbBundle/Resources/config/version.yml" }
# Swiftmailer Configuration
swiftmailer:
transport: smtp
host: 127.0.0.1
port: 25
encryption: null
sender_address: info@domain.com
logging: "%kernel.debug%"编辑
我已经设置了一个app_uat.php。它基于app.php:
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);
*/
//require_once __DIR__.'/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('uat', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);我已经检查了编辑2,prod环境正在运行,而不是uat。我无法设置我的apache配置来运行uat.下面是:
<VirtualHost *:80>
ServerName uat.gpsc.domain.com
DocumentRoot /var/www/vhosts/uat.gpsc.domain.com/current/web
<Directory /var/www/vhosts/uat.gpsc.domain.com/current/web>
AllowOverride All
Require all granted
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app_uat.php [QSA,L]
</IfModule>
</Directory>
ErrorLog /var/log/apache2/uat.project_error.log
CustomLog /var/log/apache2/uat.project_access.log combined
</VirtualHost>发布于 2016-07-30 00:12:54
您是否通过app_uat.php访问该站点?(应该在web目录中创建一个新的前端控制器文件),在该文件中,您应该设置:
$kernel = new AppKernel('uat', true);//or 'uat', false这是在http://symfony.com/doc/current/configuration/environments.html中描述的过程
如果您创建了一个app_uat.php,请用您的更新您的答案。
编辑:--这与您设置Apache的方式有关,因为您的app_uat文件似乎是正确的。但我会留下答案的前一部分,以防其他人需要它(这是很好的第一步)。
从apache文件来看,似乎一切都很好,。但也请确保:
<IfModule mod_rewrite.c>及其结束标记..。因此,您必须启用重写模块!sudo a2enmod rewrite来激活Apache的重写模块。sudo service apache2 restartAllowOverride All意味着任何htaccess文件都可以覆盖该行为。确保这事不会发生。通过执行ls -a列出symfony根文件夹或其web文件夹中的任何隐藏文件https://stackoverflow.com/questions/38668582
复制相似问题