简体   繁体   中英

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). I just used FTP account to upload directories. I have made no changes before I upload the application to my hosting except I removed the directory \\var\\cache and \\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.

UPDATE

Step 1. I moved all SF directories in home directory like so,

home/swipecom

  • cache
  • contactless (Where SF directories live)
  • public_html ( /web the only SF directory)
  • var
  • ssl
  • tmp
  • public_ftp
  • logs

Step 2. I created an .htaccess in public_html like so

<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

<?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.

在此处输入图片说明

The web folder should be your web root.

Also you will need to keep your var\\cache and var\\logs folders. They are there for a reason.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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