Maxim Volkov2020-11-12 18:00:46
Maxim Volkov, 2020-11-12 18:00:46

After migrating the Laravel application to the server, the application does not see the controllers. How to fix?

I'm trying to transfer a site from a local server to a server. In the process, I transferred files, created and imported a database dump, changed . ENV to connect the MySQL database, and also went to the root folder via SSH and executed the php artisan commands to clear the cache.

The site opens, but when you try to follow the link, you get an error:


Target class [App\Http\Controllers\infoController] does not exist . -
According to the error message, the InfoController.php controller is missing . But this file - the controller is actually present on the disk, and was not lost during the transfer from LAN.

How to solve the problem? Where to look?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
feycot, 2020-11-12

Check that the file name matches the class name.
By mistake, the controller name is capitalized.

Maxim Volkov, 2020-11-12

The problem is resolved. Cause the controller file name was lowercase InfoController.php , the class name is capitalized

class InfoController extends Controller

Everything worked on the local server under Windows, but the problem appeared on the transfer to hosting.

pLavrenov, 2020-11-13

For any update of files on the server, you must use a certain set of commands (depending on the functionality).
In this case composer dump-autoload will solve the problem. (run even when you rename the file manually)
If the queues are running, then they are cached and you need to restart.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question