简体   繁体   English

CPANEL上的Symfony 3应用程序无法正常工作

[英]Symfony 3 application on a CPANEL won't work

I have working symfony 3 application on my local computer and I have uploaded the whole application on my CPANEL hosting that has no SSH access and under root public_html (www.domain.com). 我在本地计算机上有正在运行的symfony 3应用程序,并且已将整个应用程序上载到了没有SSH访问权限且位于root public_html (www.domain.com)下的CPANEL主机上。 I just used FTP account to upload directories. 我只是使用FTP帐户上传目录。 I have made no changes before I upload the application to my hosting except I removed the directory \\var\\cache and \\var\\logs . 在将应用程序上载到主机之前,我没有做任何更改,只是删除了目录\\var\\cache\\var\\logs

However, when I try to access the application using the url, all I see are the application directories and application doesn't run. 但是,当我尝试使用url访问应用程序时,我看到的只是应用程序目录,而应用程序未运行。

UPDATE 更新

Step 1. I moved all SF directories in home directory like so, 步骤1.将所有SF目录移到主目录中,如下所示:

home/swipecom 家庭/ swipecom

  • cache 快取
  • contactless (Where SF directories live) 非接触式 (SF目录所在的位置)
  • public_html ( /web the only SF directory) public_html( /web是唯一的SF目录)
  • var 变种
  • ssl ssl
  • tmp tmp
  • public_ftp public_ftp
  • logs 日志

Step 2. I created an .htaccess in public_html like so 第2步。我像这样在public_html创建了一个.htaccess。

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /web/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

Here's the error I encountered. 这是我遇到的错误。

在此处输入图片说明

UPDATE 更新

I've changed the path of public_html/web/app.php like so, to redirect to /home2/swipecom/contactless/app/autoload.php 我已经像这样更改了public_html/web/app.php的路径,以重定向到/home2/swipecom/contactless/app/autoload.php

<?php

use Symfony\Component\HttpFoundation\Request;

/** @var \Composer\Autoload\ClassLoader $loader */

$loader = require '/home2/swipecom/contactless/app/autoload.php';
include_once '/home2/swipecom/contactless/var/bootstrap.php.cache';

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);

// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Here's what I encountered 这是我遇到的

在此处输入图片说明

UPDATE 更新

I've googled the problem and I found out that there's an issue with PHP version, that is why I quick to change my PHP version from 5.4 (native) to 5.5 and here I got another problem. 我已经搜索了这个问题,发现PHP版本存在问题,这就是为什么我快速将PHP版本从5.4(本机)更改为5.5并导致另一个问题的原因。

在此处输入图片说明

The web folder should be your web root. web文件夹应该是您的Web根目录。

Also you will need to keep your var\\cache and var\\logs folders. 另外,您将需要保留var\\cachevar\\logs文件夹。 They are there for a reason. 他们在那里是有原因的。

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

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