skip to Main Content

I created a Symfony app following the documentation in https://symfony.com/doc/current/setup.html

And in my local server I use php bin/console server:run to server the app and everything was good.

But now that I want to deploy that app in a shared server that I use for small PHP apps (like corporate app without too many logic) I cannot make it work… In similar servers I have zend framework apps working correctly, but the symfony one is not working.

I notice that there isn’t any index.php file in the root.
It’s a simple server with apache where I just drag the files through FTP (don’t have SSH connection) but the server is not executing the php framework

Do i have to generate a build or something like that in order to mvoe the generated files to the server?

3

Answers


  1. Chosen as BEST ANSWER

    Well, finally it was much simpler solution that I was told. I just copy and pasted all the content of my project (including the public folder) in the public_html folder that was generated by my shared server.

    Then create an .htaccess in the public_html with the following content:

    RewriteEngine On
    RewriteRule .* public/index.php
    

    And that was all!


  2. There is an index.php in the “public” directory, which should be the “root” for your public webserver path.

    Please see this page for the details regarding the webserver configuration, including Apache:

    https://symfony.com/doc/current/setup/web_server_configuration.html

    Login or Signup to reply.
  3. Look, you can do this, but you shouldn’t.

    You are going to waste days on figuring out how to manage deployment, install dependencies, empty/warmup cache, and this is just for the most basic symfony application.

    Stop it right now, save yourself the headache and buy a VPS.

    I have given this advise many times, most of the time it fell on deaf ears. One time I asked a fellow developer this: Was the 40 hours you wasted on this worth it? You billed your client 40 hours for this, a suitable VPS would have only cost half (all in all), and would have spared you a ton of future headaches.

    (Arne’s post about the server config is technically the correct answer though)

    EDIT: I’m not suggesting you should use the php server on a VPS. A VPS would still need apache / nginx.

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