CakePHP Cannot Start with 500 Error

Asked 1 years ago, Updated 1 years ago, 81 views

I'm having trouble starting CakePHP.

The error log contains the following:

[22-Oct-2019 07:39:11 Asia/Tokyo] PHP Fatal error: Uncaught Error: Class'Cake\Http\Server'not found in/Applications/MAMP/htdocs/mycakeapp/webroot/index.php:37
Stack trace:
 #0 {main}<br>thrown in/Applications/MAMP/htdocs/mycakeapp/webroot/index.php on line 37

The 37th line of webroot/index.php reads as follows:

//Bind your application to the server.
$server=newServer(newApplication(dirname(__DIR__).'/config'));

I'm at a loss because I can't find out no matter how many times.
Could someone please teach me?

php cakephp

2022-09-30 21:43

1 Answers

Uncaught Error: Class'Cake\Http\Server'not found error indicates that the file defined in \Cake\Http\Server could not be found.

Possible causes and actions at this stage are

  • composer install failed
      Do you have
    • /Applications/MAMP/htdocs/mycakeapp/vendor/cakephp/cakephp/src/Http/Server.php?
    • Delete the
    • vendor/ directory and try composer install on the terminal
  • Autoloader not loaded
    • Are you loading vendor/autoload.php in webroot/index.php?
    • Check the description and try composer dumpautoload on the terminal
  • webroot/index.php does not contain a use Cake\Http\Server; declaration
    • Check out the webroot/index.php description
    Do you have
  • /Applications/MAMP/htdocs/mycakeapp/vendor/cakephp/cakephp/src/Http/Server.php?
  • Delete the
  • vendor/ directory and try composer install on the terminal
  • Are you loading vendor/autoload.php in webroot/index.php?
  • Check the description and try composer dumpautoload on the terminal
  • Check out the webroot/index.php description

That's about it.


2022-09-30 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.