Using Symfony on a Shared Host

Disclosure: Some of the links on this site are “affiliate links.” This means if you click on the link and purchase the item, I will receive an affiliate commission.

Comments

  1. says

    Hello Cindy,

    I currently fight with a symfony2 deploy on a shared hosting.

    The issue that I’m encountering is how to make http://mydomain.com to use the symfony prod front controller (app.php)? From what I know, having a public_html folder on a shared hosting you tipically add an “index.php” or “index.html”, etc file there, but that doesn’t fit the symfony2 architecture.

    Also, regarding your post: “If you move the web folder then you will need to change the paths to this folder in the front controller” – There is a cookbook entry for that: http://symfony.com/doc/current/cookbook/configuration/override_dir_structure.html#override-the-web-directory.

    Cheers,
    Florin

    • Cindy says

      Florin, Make sure you have the .htaccess file set up correctly inside the puglic_html folder. This line will redirect it to the app.php instead of index.php:

      # Rewrite all other queries to the front controller.
      RewriteRule .? %{ENV:BASE}/app.php [L]

  2. says

    After I checked that .htaccess file I noticed that everything is ok, the line is there.
    I’ve then tested another route that worked (domain/test-route).

    Guess what? The whole thing was just a “browser caching” issue. :)) I’ve opened an incognito window and hit the main domain and the thing worked as intended.

    Thanks!

    • Cindy says

      Great! Glad you got it working. Also, in case others may be having the problem, it could be a Symfony cache problem as well. So, they should try clearing the Symfony cache too. Thanks for leaving an update!

    • Gerardo says

      Hey there! I am having problems deploying my Symfony project on a shared hosting – hostagator.
      The website is visible but all the images and other assets do not seem to work. They are not found. Can you please tell me how you achieved deploying it on a shared hosting.
      Thanks

  3. Jim says

    I am using Symfony on a Bluehost shared host. Everything has been working fine (still in beta), but I am now trying to use Bluehost’s Free Shared SSL Certificate for Registration, Login, etc.

    As per the instructions, I used the following URL to access the Sign In page:

    https://box####.bluehost.com/~username/login

    This works fine. However, after I am Signed in I would like the URL to return to my domain name (e.g. http://example.com/).

    This does not happen. The page goes to: https://box####.bluehost.com/~username/

    And then whatever page I go to the URL remains: https://box####.bluehost.com/

    Do you know what the best solution is to this problem? Is this a Symfony issue or a Bluehost issue?

    Do you know how to revert back to my domain name from the Bluehost domain name?

    Thank you for any help.

    Jim

  4. Jyotsna says

    I want to upload my Symfony project to my shared hosting. Folder structure as follows:

    public_html/projects/Symfony/MyAppName

    how to configure paths now?

    • Cindy Cullen says

      You should be able to just change the paths to the app, src and vendor folders in your front controller.

  5. Jan Willems says

    Hi Cindy,

    Have you already tried to deploy a Symfony 4 application to a shared hosting?
    I’m always interested in how to do it for the latest version…

    Thank you for helping me out…

    Jan

    • cindy cullen says

      No, Jan, I’ve moved on to Laravel. I still deploy Laravel projects to shared hosting – actually, easier than symfony in my opinion. I just copy the php files up there that I need. If I have ssh access I use the php artisan commands to migrate and seed the database. I change the .env environment variables file and make sure not to upload any development files that shouldn’t be on the production site. I’m sure there are better ways to do it and I’ll get there eventually, but done is better than perfect and as long as I’m keeping things as secure as possible, I find it works well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.