前提・実現したいこと
Symfonyのシステムがapp_dev.phpを通したdev環境でしか開けず、
HTTP ERROR 500のエラーが表示されます。
app.phpを通すと、app.phpが無くなったurlがリダイレクトされ、同じように500のエラーが出ます。
原因を確認する方法はありますでしょうか。
該当のソースコード
app.php
php
1<?php 2 3use Symfony\Component\ClassLoader\ApcClassLoader; 4use Symfony\Component\HttpFoundation\Request; 5 6umask(0000); 7 8//$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; 9 10// Use APC for autoloading to improve performance. 11// Change 'sf2' to a unique prefix in order to prevent cache key conflicts 12// with other applications also using APC. 13/* 14$loader = new ApcClassLoader('sf2', $loader); 15$loader->register(true); 16*/ 17$loader = require __DIR__.'/../app/autoload.php'; 18include_once __DIR__.'/../var/bootstrap.php.cache'; 19 20 21//require_once __DIR__.'/../app/AppKernel.php'; 22//require_once __DIR__.'/../app/AppCache.php'; 23 24$kernel = new AppKernel('prod', false); 25$kernel->loadClassCache(); 26//$kernel = new AppCache($kernel); 27Request::enableHttpMethodParameterOverride(); 28$request = Request::createFromGlobals(); 29$response = $kernel->handle($request); 30$response->send(); 31$kernel->terminate($request, $response); 32
app_dev.php
php
1<?php 2 3use Symfony\Component\HttpFoundation\Request; 4use Symfony\Component\Debug\Debug; 5 6umask(0000); 7 8// devモードを許可するホスト 9 10$allowHosts = array( 11 '127.0.0.1', 12 'fe80::1', 13 '::1', 14 '203.141.131.218', 15 '192.168.33.1', 16 '192.168.255.*', 17); 18 19//if (isset($_SERVER['HTTP_CLIENT_IP']) 20// || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 21// || !in_array(@$_SERVER['REMOTE_ADDR'], $allowHosts) 22//) { 23// header('HTTP/1.0 403 Forbidden'); 24// exit; 25//} 26 27$loader = require __DIR__.'/../app/autoload.php'; 28//$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; 29Debug::enable(); 30 31//require_once __DIR__.'/../app/AppKernel.php'; 32 33$kernel = new AppKernel('dev', true); 34$kernel->loadClassCache(); 35Request::enableHttpMethodParameterOverride(); 36$request = Request::createFromGlobals(); 37$response = $kernel->handle($request); 38$response->send(); 39$kernel->terminate($request, $response); 40
AppKernel.php
php
1<?php 2 3use Symfony\Component\HttpKernel\Kernel; 4use Symfony\Component\Config\Loader\LoaderInterface; 5 6class AppKernel extends Kernel 7{ 8 public function registerBundles() 9 { 10 $bundles = array( 11 new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 12 new Symfony\Bundle\SecurityBundle\SecurityBundle(), 13 new Symfony\Bundle\TwigBundle\TwigBundle(), 14 new Symfony\Bundle\MonologBundle\MonologBundle(), 15 new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 16 new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 17 new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 18 new JMS\AopBundle\JMSAopBundle(), 19 new JMS\DiExtraBundle\JMSDiExtraBundle($this), 20 new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), 21 new Ahi\Sp\AdminBundle\AhiSpAdminBundle(), 22 new Ahi\Sp\PublicBundle\AhiSpPublicBundle(), 23 new Ahi\Sp\CommonBundle\AhiSpCommonBundle(), 24 new Liuggio\ExcelBundle\LiuggioExcelBundle() 25 ); 26 27 if (in_array($this->getEnvironment(), ['dev', 'test'],true)) { 28 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 29 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 30 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 31 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 32 } 33 34 return $bundles; 35 } 36 37 public function getRootDir() 38 { 39 return __DIR__; 40 } 41 42 public function getCacheDir() 43 { 44 return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); 45 } 46 47 public function getLogDir() 48 { 49 return dirname(__DIR__).'/var/logs'; 50 } 51 52 public function registerContainerConfiguration(LoaderInterface $loader) 53 { 54 $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml'); 55 } 56} 57
autoload.php
php
1<?php 2 3use Doctrine\Common\Annotations\AnnotationRegistry; 4use Composer\Autoload\ClassLoader; 5 6/** 7 * @var $loader ClassLoader 8 */ 9$loader = require __DIR__.'/../vendor/autoload.php'; 10 11AnnotationRegistry::registerLoader(array($loader, 'loadClass')); 12 13return $loader;
補足情報(FW/ツールのバージョンなど)
Symfony 3.0.9
PHP 5.6
あなたの回答
tips
プレビュー