简体   繁体   English

Symfony 托管在 heroku 中,出现 SqlLite 错误

[英]Symfony hosted in heroku with SqlLite error

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.所以我在 heroku 中上传了我的 Symfony 5。 It is working well in localhost,no error,but after hosting in Heroku I get above error.它在 localhost 中运行良好,没有错误,但是在 Heroku 中托管后,我得到了上述错误。 I have used SqlLite我用过 SqlLite

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

doctrine_heroku.yaml学说_heroku.yaml

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

How to resolve this?如何解决这个问题?

Did you install symfony/apache-pack .你安装了symfony/apache-pack吗? It allows you to access any URL on your application without having to include /index.php in the path.它允许您访问应用程序上的任何 URL,而无需在路径中包含 /index.php。

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:为了快速启用 Apache web 服务器的重写,您可以安装 symfony/apache-pack 配方,它将合适的 .htaccess 文件放入您的公共目录:

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

Source: Heroku来源:Heroku

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM