I have done a cakephp 2 to cakephp 3 upgrade, and that was causing problems, so I found I had to replace the app/webroot with a new set of files that were part of the cakephp 3 skeleton, but now I am getting this error:
Fatal error: Uncaught Error: Class 'Cake\Http\Server' not found in /usr/share/nginx/html/web/app/webroot/index.php:33 Stack trace: #0 /usr/share/nginx/html/web/index.php(47): require() #1 {main} thrown in /usr/share/nginx/html/web/app/webroot/index.php on line 33
After some research, I found this page: https://api.cakephp.org/3.3/
, which shows the classes that should be availabe, and I found that if I go to my_cake_project/web/lib/Cake
and run ls
I get:
basics.php bootstrap.php config Configure Controller Error I18n Log Network src tests Utility View bin Cache Config Console Core Event LICENSE.txt Model Routing Test TestSuite VERSION.txt
But I am missing several libraries that are supposed to be in CakePHP 3, including the Http folder, and I believe that is why Cake/Http/Server is not found.
I have tracked down the line that is triggering the error to this:
// Bind your application to the server.
$server = new Server(new Application(dirname(__DIR__) . '/config'));
This is in app/webroot/index.php.
I tried splitting that up to:
$a = new Application(dirname(__DIR__) . '/config');
$server = new Server($a);
just for testing, and I found that it is also saying that the Class Application
can not be found.
This is the whole file of app/webroot/index.php that I have:
<?php
/**
* The Front Controller for handling every request
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
// for built-in server
if (php_sapi_name() === 'cli-server') {
$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
$url = parse_url(urldecode($_SERVER['REQUEST_URI']));
$file = __DIR__ . $url['path'];
if (strpos($url['path'], '..') === false && strpos($url['path'], '.') !== false && is_file($file)) {
return false;
}
}
require dirname(dirname(__DIR__)) . '/vendors/autoload.php';
use App\Application;
use Cake\Http\Server;
// Bind your application to the server.
$server = new Server(new Application(dirname(__DIR__) . '/config'));
// Run the request/response through the application
// and emit the response.
$server->emit($server->run());
So I must be missing the file for the Application class too
And based on comparing what I have in lib/Cake
folder with https://api.cakephp.org/3.3/
I a missing a bunch of cakephp lib folders.
I seem to be missing not just Http
, but also:
`Auth`, `Collection`, `Database`, `Datasource`, `Filesystem`, `Form`, `Mailer`, `ORM`, `Shell`, `Utility`, and `Validation`
Why am I missing these?, and where or how can I find and install all the missing libraries into my cakephp appliation?