Composer - failed opening required for phpseclib - php

I am trying to run a PHP file in a Vagrant VM which also uses composer for the build.
I am getting the following errors:
PHP Warning: require(/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /var/www/ispe/vendor/composer/autoload_real.php on line 66
Warning: require(/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required '/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
Fatal error: require(): Failed opening required '/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
Now as far as I can tell, phpseclib shouldn't be required for this particular functionality, or anything else (though I haven't 100% confirmed the anything else bit yet).
Even so, I decided to add it to my composer.json ("phpseclib/phpseclib": "2.0.4") to get rid of the errors, with no luck.
I'm fairly new to Composer, so I am wondering precisely what I might be doing wrong here or what needs to be setup.
I can confirm that the directory /var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/ exists, however there is no file bootstrap.php inside the directory.
Instead I see the following:
Crypt File Math Net System
EDIT: I also want to clarify that the file autoload.php is inside the vendor directory and that the PHP version of the VM is 7.0.

I strongly believe that the cache is the problem, It cannot be 100% sure but try destroying your Vagrant instance, or
You could follow the following steps:
Delete the vendor folder
Delete composer.lock
Run the command composer clearcache (or clear-cache)
Run composer install

Oneliner for easy copy/pasting:
rm -rf vendor composer.lock && composer clearcache && composer install

Related

localhost phpMyAdmin wont open because I deleted composer folder inside it

I am new to php and usage of composer in php. I am using windows 10.
While trying to delete previous installation of composer I think I have mistakenly deleted the composer folder inside phpMyAdmin. Now I am getting the below error while trying to access http://localhost/phpmyadmin/ :
Warning: require_once(C:\xampp\phpMyAdmin\vendor/composer/autoload_real.php): failed to open stream: No such file or directory in C:\xampp\phpMyAdmin\vendor\autoload.php on line 5
Fatal error: require_once(): Failed opening required 'C:\xampp\phpMyAdmin\vendor/composer/autoload_real.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\phpMyAdmin\vendor\autoload.php on line 5
was there supposed to be a composer folder inside phpMyAdmin by default? Did I delete something that was used by mysql?
How do I solve it?
The vendor folder is required yes. If there's a composer.json file present in your phpmyadmin folder you can run composer install to fetch all dependencies into the vendor folder.
Go To xampp>phpMyAdmin first then run "composer install" on your git bash or any other terminal.I hope it will work

Can't call php artisan

I'm setting up my Laravel environment, having installed composer and laravel. I can't call php artisan
I've tried installing and updating, however I'm still being returned errors.
C:\Users\Pat\personal> php artisan PHP Warning:
require(C:\Users\Pat\personal/vendor/autoload.php): failed to open
stream: No such file or directory in C:\Users\Pat\personal\artisan on
line 18
Warning: require(C:\Users\Pat\personal/vendor/autoload.php): failed to
open stream: No such file or directory in
C:\Users\Pat\personal\artisan on line 18 PHP Fatal error: require():
Failed opening required 'C:\Users\Pat\personal/vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in C:\Users\Pat\personal\artisan on
line 18
Fatal error: require(): Failed opening required
'C:\Users\Pat\personal/vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in C:\Users\Pat\personal\artisan on
line 18 PS C:\Users\Pat\personal>
the vendor folder is missing so you got this error:
Warning: require(C:\Users\Pat\personal/vendor/autoload.php): failed to
open stream: No such file or directory in
C:\Users\Pat\personal\artisan on line 18
Run this command in your command prompt:
composer update --no-scripts
composer update
composer update --no-scripts It will Skips execution of scripts defined in composer.json file.
composer update It will update your depencencies as they are specified in composer.json file.
With this command, you will re-create the vendor folder in your project
Type on CLI:
composer install
run this command first
composer dump-autoload
source and credits to: require(vendor/autoload.php): failed to open stream on Synchro comment
Check there might not vendor folder in your project root. So first run composer install command in the terminal. And it will generate the file that are missing.

Composer not working with laravel after Windows update 1903

Yesterday I updated my windows from version 1803 to 1903. Today I tried to continue work on my laravel application and tried to run PHP artisan serve for development.
What I got was an error message:
PHP Warning: require(C:\Users\MY_USERNAME\MY_PROJECT/vendor/autoload.php): failed to open stream: No such file or directory in artisan on line 18
Warning: require(C:\Users\MY_USERNAME\MY_PROJECT/vendor/autoload.php): failed to open stream: No such file or directory in artisan on line 18
PHP Fatal error: require(): Failed opening required 'C:\Users\MY_USERNAME\MY_PROJECT/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in artisan on line 18
Fatal error: require(): Failed opening required 'C:\Users\MY_USERNAME\MY_PROJECT/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in artisan on line 18
But those files exist. I did not change anything after updating to windows 1903.
Its because you haven't installed Composer dependencies so
Cd To your project and run composer install in your terminal
I had this same problem because of the Windows update and I couldn't do composer install in my original project because it didnt find the composer.json, so... I pushed it on Github, downloaded and then made composer install on the new project and it works. Maybe it's not the best solution... but worked for me

php warning require error

I need to make a CRUD application with laravel, and i installed it just like how it is supposed too but now i get this error. I am just checking what version of laravel i have installed but somehow this shows up? i am no expert on any means. Can someone help.
C:\Users\Gebruiker\blog>php artisan --version PHP Warning:
require(C:\Users\Gebruiker\blog\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\Users\Gebruiker\blog\bootstrap\autoload.php on line 17
Warning:
require(C:\Users\Gebruiker\blog\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\Users\Gebruiker\blog\bootstrap\autoload.php on line 17 PHP Fatal
error: require(): Failed opening required
'C:\Users\Gebruiker\blog\bootstrap/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\Users\Gebruiker\blog\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required
'C:\Users\Gebruiker\blog\bootstrap/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\Users\Gebruiker\blog\bootstrap\autoload.php on line 17
When you first create a laravel project, there's a folder called vendor that laravel needs. Laravel the framework itself exists there among other folders there. There is a file named autoload.php that is vendor folder that loads all the packages that laravel uses. For you to get these packages, you'll run this command below
composer install
then laravel can now work, so can php artisan command too.
you have to update your wamp server, the php version has to be at least 5.7
When starting any new Laravel project make sure you run composer install

How to use libphonenumber for php

I was having difficulty getting libphonenumber for PHP to run as per this question.
All I got was:
My output:
Warning: require(/var/www/phone/libphonenumber/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/phone/libphonenumber/index.php on line 2
Fatal error: require(): Failed opening required '/var/www/phone/libphonenumber/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/php/PEAR:/var/www/cakephp/lib') in /var/www/phone/libphonenumber/index.php on line 2
What finally got it working was installing composer, and moving the generated composer.phar file into the libphonenumber folder, then running the install procedure. This step is missing from the docs, so I wanted to list it here. Thank you to #Simon_eQ for assisting me with this.
Try this command:
php composer.phar dump-autoload
This will generate autoload files if not already present.

Categories