Laravel: How to recover deleted folder from vendor directory - php

I used composer to get the laravelcollective/html dependency. But later on I did not need this and I accidentally deleted the folder myself without asking composer to do it for me. Now, whenever I try to run a local server or issue the update command with composer I get the following error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php): failed to open stream: No such file or directo
ry in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php' (include_path='.:/usr/share/p
hp:/usr/share/pear') in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
Even though the /laravelcollective directory does not exist anymore I still get this error. I have tried removing the whole vendor folder from my Laravel project and then issued a composer update command but I get this error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /media/
adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share
/pear') in /media/adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17

It seems the problem was fixed by issuing the install command instead of update. I also removed the composer.lock file from its directory, but I don't think that made a difference.

Related

Error while using running chat application in CodeIgniter 4

Downloaded a git repo for a chat application using the below link
Git Repo for Chat Application
Then changed the env file to .env file and also uncommented default database block as shown below.
database.default.hostname = localhost
database.default.database = chat
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi
Then opened terminal and executed this command php spark migrate
But while executing this error pops up
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial> php spark migrate
PHP Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to
open stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open
stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial>
How to resolve this? Any help appreciated.
It looks to me that you didn't run the composer update command after starting the project. So in this case your vendor folder is probably missing a lot of files.
Go to the root of your project in the terminal and run:
$ composer update
And you should be fine.

What reason 'Warning: require(C:\wamp64\www\laravel\bootstrap/../vendor/autoload.php) failed to open stream:

1 I downloaded laravel project from github after install composer
(intalled composer version 1.9.0) and php version in wamp server (PHP 7.3.1)
2 create database and configure db name,username and password(no password) in .env file.
3 After database setup, I used artisan command for database migration:
php artisan migrate
show error message below:
Warning:
require(C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap\autoload.php
on line 17
and this
Fatal error: require(): Failed opening required
'C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap/../vendor/autoload.php'
(include_path='.;C:\php\pear') in
C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap\autoload.php
on line 17
What is the solution for error message.Thanks for advance
Try this : composer update --no-scripts
A stackoverflow question.
If you land with some warnings of PHP versions then you have to use correct php version.

Running "laravel new" command in laravel project

I accidentally ran the laravel new command in a laravel project, which apparently deleted autoload_real.php
I get these error messages when running php artisan serve:
"PHP Warning: require(C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
Warning: require(C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66"
Is there a way to get back autoload_real.php?
Just run:
composer update
inside your project, it should fix it.
Check if the file actually exists. If it's missing, but the folder 'symfony/polyfill-ctype' is there and empty, try to delete vendor folder and run composer install again. It might be that composer install crashed previous time and it thinks the package is there. That was the case for me.

Autoload issue in PhpStorm and Laravel

I have created a Laravel project using PhpStorm but when I open index.php in the browser it shows some errors.
It opens http://localhost:63342/METU/public/index.php but it should be http://localhost:63342/index.php.
Warning: require(C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
What is wrong with my project?
That error generally occurs when you haven't run composer install on a new laravel project. The autoload file it references will be created when you run that command.
As for the URL issue, you want to make sure your localhost is mapped to the /public folder of your laravel project, not mapped to the root of it.

Cache access issue while installing preproduction on symfony

I am currently trying to install a preproduction branch on my dedicated serveur.
I installed a Symfony version in the /web/preprod directoty of my symfony production project. I managed to link correctly the front controller and the routes, and now I am calling an action in the preprod branch.
I am getting this error message :
Warning:
require_once(/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod_new/jms_diextra/proxies/CityDom-APIBundle-Controller-GangController.php):
failed to open stream: No such file or directory in
/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod/jms_diextra/controller_injectors/CityDomAPIBundleControllerGangController.php
on line 13
Fatal error: require_once(): Failed opening required '/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod_new/jms_diextra/proxies/CityDom-APIBundle-Controller-GangController.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod/jms_diextra/controller_injectors/CityDomAPIBundleControllerGangController.php
on line 13
The preprod cache folders are on permission 777.
Not all action aren't working, but this one doesn't.
See Setting up Permissions in this section. Go with the setfacl command.

Categories