0

This is my first deployment in Symfony 5 and I've been struggling a couple days with deployment because my website is showing a blank page. I'm using Infinity Free Web Hosting with:

  • PHP Version 7.3.6
  • Apache
  • My website doesn't have a db.

So before I start to upload files with FileZilla, I run this commands:

SET APP_ENV=prod
composer install --no-dev --optimize-autoloader
composer dump-autoload --optimize --no-dev --classmap-authoritative

My folder structure goes like this

  • htdocs
    • \css
    • \downloads
    • \images
    • \scripts
    • .env.local
    • .htaccess
    • index.php
    • \symfony
      • \bin
      • \config
      • \src
      • \templates
      • \translations
      • \vendor
      • \var
      • composer.json

And modified index.php with new path:

require dirname(__DIR__).'symfony/vendor/autoload.php';

The issue is that the page is showing completely blank (not even an error). What is my mistake? I've been following instructions with this tutorial, create a "symfony" folder with bin, config, src, templates and vendor, and I copied my "public" folder content to /htdocs folder. Hosting provider doesn't allow me to upload content at the server root folder. Thanks in advance.

2
  • 3
    You should probably not start with SET APP_ENV=prod, use dev if you want to see helpful error messages. Commented Jul 7, 2020 at 13:10
  • Please have a look at your server's error log to get more information. If you need more help, add the error message from that log to your question by editing it Commented Jul 7, 2020 at 13:30

1 Answer 1

4
  • You missing a / on your require :
require dirname(__DIR__).'/symfony/vendor/autoload.php';
  • Maybe use dev environment for debugging your application.

  • You have a .env.local : are you sure is necessary and correctly read ? (symfony/dotenv is a devDependency by default)

And I think is not a good practice to have your symfony folder and index.php on same directory because it can expose your source code and sensitive data. Maybe use htaccess to expose only symfony public directory.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Adrien. I changed my environment to dev, then I was able to see that there was an error with open_basedir (my hosting provider had disabled it). As I am using a free web hosting and I can't change that configuration, I moved my website to another free hosting (AwardSpace). That file .env.local that you mention was not necesary so I removed it, enabled prod environment and now everything works fine. I also added the "/" in require path and I created folder structure in a different way, so symfony folder is not anymore in the same dir that index.php file
@Mariela Please could you explain me the new structure of your project in the server and the configuration of the .htaccess if you configured something, I have weeks and I can't get my project to work .😩😩😩
Hello, if you use the default symfony structure look at the documentation for web server configuration : symfony.com/doc/current/setup/web_server_configuration.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.