Home > Back-end >  Controller does not exist
Controller does not exist

Time:12-01

I have a problem, I cannot solve. Maybe you can help?

  • I switched to a new vHost, where I use Plesk Obsidian, to manage it.
  • On the old server I successfully delopeyed a Symfony 5 project. The project is store inside a github repository (except the local data).

So on changing to the new server I did the following:

  • I checked out the git project via ssh on the new server.
  • I installed id with composer install and updated all packages with composer update
  • I added the old database and enabled dev environment for testing.
  • I added a new subdomain in Plesk, pointing to the public directory of the symfony project.
  • I added a .htaccess file to the public directory, with following content:
<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /index.php/
    </IfModule>
</IfModule>

Now on accessing the subdomain, The default page loads. But on accessing a subpage, I get the following error:

Class "1\PageController" does not exist in /var/www/vhosts/xx/xx/config/routes/../../src/Controller/ (which is being imported from "/var/www/vhosts/xx/xx/config/routes/annotations.yaml"). Make sure annotations are installed and enabled

CodePudding user response:

The solution was

  • to remove the composer plugin of plesk
  • remove all files of the project
  • clone the git project again
  • install it as root (or any other user, not real system user)
  • do composer install

maybe that I've installed the plesk plugin, wich is still composer 1.* and not the latest, was the problem. no everything works fine.

CodePudding user response:

Maybe it's not that at all, but I had the same problem using InteliJ IDE because when you reformat your controllers, it delete the import of Anotations from the file. Maybe it will help.

  • Related