我和团队一直致力于一个相对较大的Symfony项目。我们一直在所有Windows PC上使用XAMPP本地工作,几乎没有遇到任何错误。最近我承担了在linux上测试应用程序的任务(CrunchBang linux),我遇到了一些非常严重的错误。我一直在寻找所有StackOverflow,并尝试了我能找到的所有东西。
App.php(localhost /)返回一个空白屏幕。 App_dev.php(localhost / app_dev.php)给出了以下2个错误:
1/2 ResourceNotFoundException :
in /home/tim/web/grip.dev/app/cache/dev/appDevUrlMatcher.php line 136
at appDevUrlMatcher->match('/') in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1207
at Router->match('/') in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1872
at RouterListener->onKernelRequest(object(GetResponseEvent))
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent)) in /home/tim/web/grip.dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 450
at TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}(object(GetResponseEvent))
at call_user_func(object(Closure), object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1667
at EventDispatcher->doDispatch(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1600
at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1764
at ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 139
at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2833
at HttpKernel->handleRaw(object(Request), '1') in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2818
at HttpKernel->handle(object(Request), '1', true) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2947
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2249
at Kernel->handle(object(Request)) in /home/tim/web/grip.dev/web/app_dev.php line 28
2/2 NotFoundHttpException:找不到“GET /”的路线
in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1883
at RouterListener->onKernelRequest(object(GetResponseEvent))
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent)) in /home/tim/web/grip.dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 450
at TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}(object(GetResponseEvent))
at call_user_func(object(Closure), object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1667
at EventDispatcher->doDispatch(array(object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure), object(Closure)), 'kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1600
at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/cache/dev/classes.php line 1764
at ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 139
at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2833
at HttpKernel->handleRaw(object(Request), '1') in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2818
at HttpKernel->handle(object(Request), '1', true) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2947
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in /home/tim/web/grip.dev/app/bootstrap.php.cache line 2249
at Kernel->handle(object(Request)) in /home/tim/web/grip.dev/web/app_dev.php line 28
如果我致电php app/console router:debug
,则会返回以下内容:
[router] Current routes
Name Method Scheme Host Path
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_purge ANY ANY ANY /_profiler/purge
_profiler_info ANY ANY ANY /_profiler/info/{about}
_profiler_import ANY ANY ANY /_profiler/import
_profiler_export ANY ANY ANY /_profiler/export/{token}.txt
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
_configurator_home ANY ANY ANY /_configurator/
_configurator_step ANY ANY ANY /_configurator/step/{index}
_configurator_final ANY ANY ANY /_configurator/final
所有路由都适用于使用XAMPP的Windows。
不知何故,我认为这与我的apache2配置有关。我已经设置了mod重写,web/.htaccess
使用了RewriteEngine On。我的vHosts也配置为'AllowOverride All'。
除了我发现的东西之外,我没有很多手动配置apache2的经验。
我的PHP版本是 5.4.4-14 + deb7u5 。
修改 我们将路由重定向到自定义路由文件: (应用程序/配置/ config.yml)
framework:
router:
resource: "@CoreBundle/Resources/config/routing.php"
这是我们的routing.php:
<?php
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$collection = new RouteCollection();
//Routes for other bundles go here
/*
* Route format for other bundles.
* -------------------------------
* $<bundlename>Routing = $loader->import("@<bundlenamespace>/Resources/config/routing.php");
* $<bundlename>Routing->addPrefix('<Insert bundle prefix>');
* $collection->addCollection($<bundlename>Routing);
* -------------------------------
* Add a whiteline in between each bundle route.
*/
$gripRouting = $loader->import("@GripBundle/Resources/config/routing.php");
$gripRouting->addPrefix('/grip');
$collection->addCollection($gripRouting);
$ddsRouting = $loader->import("@DDSBundle/Resources/config/routing.php");
$ddsRouting->addPrefix('/dds');
$collection->addCollection($ddsRouting);
//Routes for the core bundle go here
$collection->add('login', new Route('/login', array(
'_controller' => 'CoreBundle:Login:login',
)));
$collection->add('login_check', new Route('/login_check', array()));
$collection->add('core_logout', new Route('/logout', array()));
$collection->add('products', new Route('/products', array(
"_controller" => "CoreBundle:Default:products",
)));
$collection->add('about', new Route('/about', array(
"_controller" => "CoreBundle:Default:about",
)));
$collection->add('contact', new Route('/contact', array(
"_controller" => "CoreBundle:Default:contact",
)));
$collection->add('core_noclient', new Route("/error", array(
"_controller" => "CoreBundle:Default:noClient",
)));
// Vendor bundles
$securityCollection = $loader->import("@FOSUserBundle/Resources/config/routing/security.xml");
$collection->addCollection($securityCollection);
$profileCollection = $loader->import("@FOSUserBundle/Resources/config/routing/profile.xml");
$profileCollection->addPrefix("/profile");
$collection->addCollection($profileCollection);
$registrationCollection = $loader->import("@FOSUserBundle/Resources/config/routing/registration.xml");
$registrationCollection->addPrefix("/register");
$collection->addCollection($registrationCollection);
$resettingCollection = $loader->import("@FOSUserBundle/Resources/config/routing/resetting.xml");
$resettingCollection->addPrefix("/resetting");
$collection->addCollection($resettingCollection);
$changePasswordCollection = $loader->import("@FOSUserBundle/Resources/config/routing/change_password.xml");
$changePasswordCollection->addPrefix("/profile");
$collection->addCollection($changePasswordCollection);
$gripRouting = $loader->import("@SonataAdminBundle/Resources/config/routing/sonata_admin.xml");
$gripRouting->addPrefix('/admin');
$collection->addCollection($gripRouting);
$gripRouting = $loader->import(".", "sonata_admin");
$gripRouting->addPrefix('/admin');
$collection->addCollection($gripRouting);
$gripRouting = $loader->import("@SonataUserBundle/Resources/config/routing/admin_security.xml");
$gripRouting->addPrefix('/admin');
$collection->addCollection($gripRouting);
$collection->add('core_home', new Route('/', array(
'_controller' => 'CoreBundle:Default:index',
)));
return $collection;
答案 0 :(得分:0)
问题是看看调试说的是什么,使用&#39; http://domain.com&#39;而不是&#39; http://domain.com/&#39;访问该网站。
你没有这样的路线
home:
pattern: /
defaults: { _controller: HelloWebBundle:Default:index }
答案 1 :(得分:0)
我修好了。关于真正发生的事情,我仍然不知所措,但它似乎是由PHP-APC和我的缓存引起的。我清除了缓存,删除了文件夹的内容,并使用setfacl再次设置了权限。我还使用composer进行了更新,可能会将我的parameters.yml刷新到正确的设置。
我希望我能用这些小小的“指针”来帮助别人。