简体   繁体   English

Symfony2项目在远程服务器上的问题

[英]Symfony2 project on a distant server problems

I'm now looking about 2 weeks for running a website (very simple, just for testing the first steps like a HelloWorld) on a hosting, but still nothing. 我现在要花大约两周的时间在托管服务器上运行一个网站(非常简单,仅用于测试HelloWorld之类的第一步),但仍然一无所获。

I'm new on symfony and it could be that my error is "normal" but I cannot find my answer on the internet. 我是symfony的新手,可能是我的错误是“正常”,但我无法在互联网上找到答案。 So my problem is the following: 所以我的问题是以下几点:

I developed a website on my PC with symfony2. 我使用symfony2在PC上开发了一个网站。 It has just a little html/css page which I would like to see on the server. 它只有一点html / css页面,我想在服务器上看到。 Locally, everything works fine: no errors, nothing. 在本地,一切正常:没有错误,什么也没有。 When I upload the entire project (after clearing cache) via FTP on the hosting ( http://www.nexlink.ch/ ) I've got the following error: 当我在主机( 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.

and the logger tells me the following things: 记录器告诉我以下内容:

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)"}

What did I do wrong? 我做错了什么?

Here my controller: 这是我的控制器:

<?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;
  }
}

The problem is probably here: 问题可能在这里:

INFO - Matched route "HelloTheWorld" (parameters: "_controller": "fcbgNewsBundle:news:index", "name": "bolet", "_route": "HelloTheWorld")

As you can see this: 如您所见:

fcbgNewsBundle:news:index

It is expected as 预期为

fcbg\NewsBundle\newsController -> indexAction

But you have: 但是你有:

namespace fcbg\newsBundle\Controller;
               ^

n character with lover-case . n带有情人案例的人物。 Use upper-case and you should also use upper-cased characters at the start of your controller names ( NewsController instead of newsController ) to avoid these problems in the future. 使用大写字母,并且您还应该在控制器名称的开头( NewsController而不是newsController )使用大写字符,以避免将来出现这些问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM