Deploying Symfony2 app getting fosuserbundle errors

后端 未结 10 2085
北恋
北恋 2020-12-07 01:22

I have installed my Symfony project on another computer with the same specifications, and I receive the following error when I login with fosuserbundle:

Authe

相关标签:
10条回答
  • 2020-12-07 01:39

    I was having the exact same issue. And the steps I took were the following:

    1. I cleared the cache
    2. I brought down all my db tables and recreated them again via my migrations
    3. I replaced where I had used single quotes(') with double quotes(") in my entity annotations for arguments to constraint methods

      Example

      //src/SomeBundle/Model/user.php
      <?php
      /**
      *
      * @Assert\File(
      *  maxSize='512k',
      *  mimeTypes={'image/png', 'image/jpeg', 'image/gif'},
      *  mimeTypesMessage= 'Please upload a valid png, gif or jpeg file below 512Kb'
      * )
      */
      private $profilePic;
      
      ?>
      

      This got replaced with

      <?php
      /**
      *
      * @Assert\File(
      *  maxSize="512k",
      *  mimeTypes={"image/png", "image/jpeg", "image/gif"},
      *  mimeTypesMessage= "Please upload a valid png, gif or jpeg file below 512Kb"
      * )
      */
      private $profilePic;
      ?>
      

    After doing this, I tried the authentication again and it worked!

    0 讨论(0)
  • 2020-12-07 01:44

    You might have set a wrong password in your parameters.yml because of which it might not be able to connect to the DB. The above mentioned error occurs when the app is not able to connect to DB to check if the user is authentic. (I also faced the same error and this was my problem, hope it helps)

    0 讨论(0)
  • 2020-12-07 01:47

    Check to make sure your database is up to date. This fixed my issue when I received this error.

    php app/console doctrine:schema:update --dump-sql
    

    edit: spelling

    0 讨论(0)
  • 2020-12-07 01:48

    If you've generated the database using doctrine:database:create, maybe your charset isn't appropriate. Because User table has a serialized field (roles) a wrong encoding could be the cause.

    You can check this looking into app/logs and your database collation.

    Alternatively, check this answer

    0 讨论(0)
  • 2020-12-07 01:50

    I had the same problem. I was able to build and populate the database with php app/console doctrine:schema:update --force; php app/console doctrine:fixtures:load; but the symfony app couldn't access the database.

    The problem was I'd set database_host: 127.0.0.1 in parameters.yml but mysql was expecting me to connect through localhost. Updating parameters.yml fixed the problem. I'm still confused as to why the command line stuff worked...

    0 讨论(0)
  • 2020-12-07 01:51

    In a deploy process usually it's an environment problem (assuming that the app works fine in a dev station). FOSUserBundle it's great but for some reason it doesn't show very well the problems behind it.

    As the error message says: ".. could not be processed due to a system problem."

    if cleaning the cache nor updating the schema works, I would recommend try to bypass FOSUserBundle (usually the issue is between your code/configuration and the server environment) and let your bundle with the default errorhandler and logger inform any problem.

    in my case it was a driver problem. (install pdo)

    to bypass it, the simplest way is to remove security to a controller_action in security.yml

    access_control:
    { path: ^/SomeCRUD, role: IS_AUTHENTICATED_ANONYMOUSLY }
    

    then, if you access it, it should be able to log the issue and you should be able to fix it.

    hope it helps

    0 讨论(0)
提交回复
热议问题