![](/img/trans.png)
[英]Symfony Deploying Project on Distant Server ContextErrorException
[英]Symfony2 project on a distant server problems
我现在要花大约两周的时间在托管服务器上运行一个网站(非常简单,仅用于测试HelloWorld之类的第一步),但仍然一无所获。
我是symfony的新手,可能是我的错误是“正常”,但我无法在互联网上找到答案。 所以我的问题是以下几点:
我使用symfony2在PC上开发了一个网站。 它只有一点html / css页面,我想在服务器上看到。 在本地,一切正常:没有错误,什么也没有。 当我在主机( http://www.nexlink.ch/ )上通过FTP上传整个项目(清除缓存后)时,出现以下错误:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
记录器告诉我以下内容:
INFO - Matched route "HelloTheWorld" (parameters: "_controller": "fcbgNewsBundle:news:index", "name": "bolet", "_route": "HelloTheWorld")
CRITICAL - Uncaught PHP Exception InvalidArgumentException: "Unable to find controller "fcbgNewsBundle:news" - class "fcbg\newsBundle\Controller\newsController" does not exist." at /mnt/sites/fc-beroche.ch/web/fusio/app/cache/dev/classes.php line 2333
Context: {"exception":"Object(InvalidArgumentException)"}
我做错了什么?
这是我的控制器:
<?php
namespace fcbg\newsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class newsController extends Controller
{
public function indexAction($name)
{
echo $name;
$page = $this->render(
'base.html.twig',
array(
'content' => 'fcbgNewsBundle:Default:index.html.twig',
'titrePage' => $name,
'navigation' => array(
array(
'href' => 'http://www.youpi.com',
'titre' => 'menu1'
),
array(
'href' => 'http://www.youpi.com',
'titre' => 'menu2'
),
array(
'href' => 'http://www.youpi.com',
'titre' => 'menu3'
),
),
'css' => 'fcbgNewsBundle:Default:basicStyle.css'
)
);
return $page;
}
}
问题可能在这里:
INFO - Matched route "HelloTheWorld" (parameters: "_controller": "fcbgNewsBundle:news:index", "name": "bolet", "_route": "HelloTheWorld")
如您所见:
fcbgNewsBundle:news:index
预期为
fcbg\NewsBundle\newsController -> indexAction
但是你有:
namespace fcbg\newsBundle\Controller;
^
n
带有情人案例的人物。 使用大写字母,并且您还应该在控制器名称的开头( NewsController
而不是newsController
)使用大写字符,以避免将来出现这些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.