i have a project that build on with Symfony 4.2. I want deploy this project to a shared hosting. But on symfony documentation, there is nothing about it clearly.
I deployed all my project into hosting under public_html.
But probably panel does not find the index.php. On cpanel, i can not change the document root.
current document root: public_html
my index.php under public folder.
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ??
$_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies),
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ??
$_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool)
$_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Can someone help me about this issue?
I have a symfony4 application running under shared hosting ,so try this configuration in the .htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/index.php [QSA,L]
</IfModule>
for assets try this in framework.yaml
assets:
base_path: '/public'