Why is Symfony not working on shared host? - symfony

I installed Symfony on my local host and it is working like a charm.
But when I upload the project folder via php to my shared host it is not working.
I see only the message: This site is currently under construction.
I am using the right php version (7.1.)
This is my folder structure.
.DS_Store
.env
.env.dist
.git
.gitignore
assets
bin
composer.json
composer.lock
config
package.json
phpunit.xml.dist
public
src
symfony.lock
templates
tests
translations
var
vendor
webpack.config.js

Related

Assets not install in symfony 4

I read symfony documentation for Web Assets and create /assets directory in root of my project then run command php bin/console assets:install but get:
[OK] No assets were provided by any bundle.
I store one CSS file in assets directory but didn't install in /public
how should I do?
The web assets documentation for Symfony 4 recommends using Webpack Encore.
The assets:install command is not used in this configuration.
Here's what you have to do according to the documentation :
Install Node.js and Yarn on your computer.
Install Encore into your project with : yarn add #symfony/webpack-encore --dev
Configure webpack / Encore by editing (or creating) the webpack.config.js file as described here.
Compile your assets by running : yarn run encore dev
There is a workaround to do it clearly (more or less) while we are waiting for further webpack-encore development. Can be done by Makefile or similar way but here is more native solution.
Create blank bundle:
// src/BlankBundle/BlankBundle.php
namespace App\BlankBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class BlankBundle extends Bundle
{
}
Then put your assets to src/BlankBundle/Resources/public directory and enable the bundle:
// add it to config/bundles.php
App\BlankBundle\BlankBundle::class => ['all' => true],
After executing php bin/console assets:install command your resources will be at public/bundles/blank directory.

Autoload Bundle with custom path in Symfony2

I am developing a Symfony2 web app that will be hosted on an Ubuntu server and want my directory structure to be:
/Symfony (with an app,bin and vendor folder in it)
/Site1
/Site2
This way site1 and site2 use the same Symfony framework. In /Site1 I want:
/web
and in there I want app.php and app_dev.php as well as /web/AppBundle with all of the bundle files. I already figured out that I need to change in app.php require_once DIR.'/../Symfony/app/AppKernel.php'; in 2 places as per http://symfony.com/doc/current/cookbook/configuration/override_dir_structure.html
When I generated the bundle I did get the message "Checking that the bundle is autoloaded: FAILED" and that I should "Edit the composer.json file and register the bundle namespace in the "autoload" section"
I added "AppBundle": "/web/AppBundle" to the composer.json autoload section and in cygwin I run "composer -n install" It starts with saying that it is loading composer repositories and then it says "Installing dependencies (including require-dev)" and never goes past that.
What can I do to register this bundle that is not in the standard folder so that autoload picks it up? I am just getting the fact that the class could not be found in AppKernel.php
Thanks.
It's simple. Just don't do it! Use symfony as it is intended with its default directory structure.
Great two projects. If you have common code, extract it to an extra bundle and install it in both projects via composer.

Symfony bundles using the same vendor name in /src and /vendor

I'm breaking some of my bundles into stand alone repos that I can reuse in other projects, they are all under the same vendor namespace in my /src directory, so when I pull them out and require them with composer I end up with the same vendor name space in my /src directory and also the /vendor directory.
When I try to load my app I get a Compile Error as it's looking for the class in the /src directory.
Is there anyway around this or do I need to change my vendor name?
Turns out the opcache needed to be cleared - restarting apache solved the issue.

Why does Symfony create a separate vendor folder in my root?

when I install Symfony according to the guide (option 1 with composer) it creates the folder structure as expected (and mentioned in that guide):
path/to/webroot/
Symfony/
app/
src/
vendor/
web/
But in the root folder it also creates an empty vendor/ folder. In this vendor folder there is a subfolder named composer/.
path/to/webroot/
Symfony/
vendor/
composer/
Both directories are empty (no hidden files). So two questions:
Is this a required folder or is it kind of a bug that these folders are installed? Or may this be a directory for composer-specific files?
Can I delete this folder without any danger?
That empty folder is generated when you don't pass the target-directory parameter to composer:
php composer.phar create-project vendor/project target-directory [version]

Deploying symfony project in bitnami image on amazon ec2

The symfony is in /Frameworks folder, and the root path is in Apache2/htdocs/, how to deploy a symfony project? Do I need to copy symfony folder to htdocs, condisdering Apache2/htdocs/ like localhost/?
You can copy your Symfony folders in the htdocs folder and set Apache to serve from Symfony's 'web' folder which contains the app.php file.
You need to do some Apache configuration here, you can check this post

Resources