Can't call php artisan - php

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.

Related

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

Composer install Symfony 3.4 - bootstrap.php.cache

During the installation of my project, I had to install and update my composer. However I can't do it beacause composer tells me this :
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Warning: require_once(C:\Projects\private\p1\../app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\Projects\private\p1\bin\console on line 11
Fatal error: require_once(): Failed opening required 'C:\Projects\private\p1\bin/../app/bootstrap.php.cache' (include_path='.;C:\php\pear') in C:\Projects\private\p1\bin\console on line 11
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command:
Warning: require_once(C:\Projects\private\p1\bin/../app/bootstrap.php.cache): failed to open stream
: No such file or directory in C:\Projects\private\p1\bin\console on line 11
Fatal error: require_once(): Failed opening required 'C:\Projects\private\p1\bin/../app/bootstrap.php.cache' (include_path='.;C:\php\pear') in C:\Projects\private\p1\bin\console on line 11
I've been searching an answer for 2 days and I've tried everything I coulded see on the internet...
I don't know if you need something else but please help me
If the bootstrap.php.cache file was not created for different reasons. Normally it should be generated after running composer install in your project directory.
If you need to generate it manually, just run the following command in your Symfony project folder:
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
If you have the new Symfony 3 folder structure you need to add three arguments:
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php var app new
The file will then be generate in var/bootstrap.php.cache instead of app/bootstrap.php.cache.
Steps to solve your problem :
run this command : bin/console cache:clear --env=prod
run this chown www-data:www-data projectDirectory
run this command SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist
run this command chown www-data:www-data projectDirectory

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

Composer - failed opening required for phpseclib

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

Cakephp installation error by command php composer.phar create-project --prefer-dist cakephp/app [app_name]

Warning: require(C:\xampp\htdocs\cakephp\vendor\autoload.php): failed
to open stream: No such file or directory in
C:\xampp\htdocs\cakephp\config\bootstrap.php on line 23
Fatal error: require(): Failed opening required
'C:\xampp\htdocs\cakephp\vendor\autoload.php'
(include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\cakephp\config\bootstrap.php on line 23
This means that it can't find the autoload file produced by composer. Maybe composer could not complete the whole procedure because a package is missing.
Check this question too.
cakephp 3.* installation issue

Categories