skip to Main Content

Symfony project is not running on a remote virtual host because there is no index.php file in the project root directory. When I’m trying to open my symfony project on a localhost with

URL “localhost/symf.com”

it only shows me project folders instead of the home controller. I know I should open my site with Php bin/console server:start command, but how does it work on a remote virtual host?

Perhaps I should somehow change my project’s root directory? But I don’t have access to remote virtual host configuration

2

Answers


  1. Symfony’s homepage in at ‘YourProject/public/index.php’.
    You have to point on this file to see your home controller.

    Login or Signup to reply.
  2. In virtual host you must run prod environment not dev as your localhost. So you must configure your Apache configuration to run your project. Use following link:

    Web Server Configuration for Symfony

    Be careful, in symfony 3.4 the DocumentRoot is equal to project_path/web and in symfony 4.3 is equal to project_path/public

    You mentioned that you do not have access to your virtual host to set one by one configuration. In that case the best way is using docker-compose, so with running docker-compose up -d all the things you need to run your project will be generated automatically. But you must have enough knowledge about docker

    Be successful.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search