I’m just starting with CakePHP but having trouble running my first testing application.
I have creates a new PROJECT using
php composer.phar create-project --prefer-dist cakephp/app test
apparently with success, but when I enter the site, I see the following error:
**Warning** : require(/var/www/html/test/vendor/autoload.php): failed to open stream: No such file or directory in **/var/www/html/test/webroot/index.php** on line **31**
**Fatal error** : require(): Failed opening required '/var/www/html/test/vendor/autoload.php' (include_path='.:/usr/share/php') in **/var/www/html/test/webroot/index.php** on line **31**
I verified and the mentioned file:
does not exist, perhaps It should, I think.
/var/www/html$ composer dumpautoload
Composer could not find a composer.json file in /var/www/html
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ “Getting Started” section
and the response:
[CODE[Using version ^1.1 for cakephp/plugin-installer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing cakephp/plugin-installer (1.1.0): Downloading (100%)
Writing lock file
Generating autoload files
$ composer dumpautoload
Generating autoload files
$ bin/cake server
at last, the command indicated in the book
bash: bin/cake: No existe el archivo o el directorio
that is: file or directory does not exist
**Warning** : require(/var/www/html/bookmarker/vendor/autoload.php): failed to open stream: No such file or directory in **/var/www/html/bookmarker/webroot/index.php** on line **31**
**Fatal error** : require(): Failed opening required '/var/www/html/bookmarker/vendor/autoload.php' (include_path='.:/usr/share/php') in **/var/www/html/bookmarker/webroot/index.php** on line **31**
So, I suspect composer is not creating missing file
… and maybe others.
Seems like it’s pretty much the same as mine.
You could try to remove everything in the directory but the composer.json (so only leaving the composer.json) then running composer install.
It should download everything again and have you start with everything needed.
sorry for bring this old post from last year, i did have the same issue than obsidiana, but ur recommendation worked well for me! After i did remove everything what u said, i did composer working with composer.json (worked without problems), and creating again the new cake project, moved to the same project where composer.json is. After everything, with cake server worked and running now. im glad to find that issue! Please pin this to people check this if everyone does have the same situation like me and obsidiana. Laters!
I had same problem.
The solution for me that was the next:
When I install the cake with composer, I got the error message:
phpunit/phpunit 8.5.8 requires ext-dom * -> the requested PHP extension dom is missing from your system
The installation of php-dom then remove cakephp folder and install the cakephp with composer again is solved the problem.