Home > Back-end >  Symfony hosted in heroku with SqlLite error
Symfony hosted in heroku with SqlLite error

Time:11-25

Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET http://task-demi.herokuapp.com/api/register": Method Not Allowed (Allow: POST)" at /app/vendor/symfony/http-kernel/EventListener/RouterListener.php line 140

So I have uploaded my Symfony 5 in heroku. It is working well in localhost,no error ,but after hosting in Heroku I get above error. I have used SqlLite

DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

doctrine_heroku.yaml

doctrine:
    dbal:
        driver: 'pdo_sqlite'
        server_version: '3.15'

How to resolve this?

CodePudding user response:

Did you install symfony/apache-pack. It allows you to access any URL on your application without having to include /index.php in the path.

In order to quickly enable rewriting for the Apache web server, you can install the symfony/apache-pack recipe, which places a suitable .htaccess file into your public/ directory:

composer require symfony/apache-pack
git add composer.json composer.lock symfony.lock public/.htaccess
git commit -m "apache-pack"

Source : Heroku

  • Related