- [SOLVED] Laravel Error: Failed to open stream: No such file or directory bootstrap/autoload.php
- Share this:
- Related posts:
- app/bootstrap.php.cache : failed to open stream: No such file or directory
- Related videos on Youtube
- YuriiChmil
- Comments
- Saved searches
- Use saved searches to filter your results more quickly
- First Run on Command Line: app/bootstrap.php.cache): failed to open stream: #16
- First Run on Command Line: app/bootstrap.php.cache): failed to open stream: #16
- Comments
- Php – file_put_contents(…/bootstrap/cache/services.json): failed to open stream: No such file or directory
- Best Solution
[SOLVED] Laravel Error: Failed to open stream: No such file or directory bootstrap/autoload.php
You might get the following error while trying to run Laravel for the first time.
Warning: require(/var/www/laravel/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/laravel/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required ‘/var/www/laravel/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/laravel/bootstrap/autoload.php on line 17
Problem Scenario:
This error generally occurs when you download/clone Laravel from Github and then you put it in your web server. Then, you try to access it through your browser (e.g. http://localhost/laravel/public).
Though you have downloaded the Laravel code and put it in your server, there’s still missing dependencies (library files/codes) in the code. The missing dependencies should be installed in order to make Laravel run properly.
Once you have installed composer on your system/computer, then you need to follow the steps below to install the missing dependencies:
- Open terminal or command prompt
- Go to your Laravel directory
- For example, in Ubuntu Linux the web root is /var/www/, in Windows if you install Wampp in C: Drive then the web root will be C://wampp/www
- Suppose, you downloaded and copied the Laravel files in directory named ‘laravel’
- Then, your Laravel directory on your web server in Ubuntu will be /var/www/laravel
- You can go to that directory by running the following command on terminal: cd /var/www/laravel
- This will install the required dependencies to run Laravel. It will take some time to install all the dependencies.
- Now, you should be able to access Laravel properly without any error, e.g. http://localhost/laravel/public
If you already have run composer install command and still getting the error, then you can try running the following command:
Note: If you are on Linux then you should also set write permission to bootstrap/cache and storage directories.
Here’s the command to do so:
sudo chmod -R 777 bootstrap/cache storage
Alternatively, the better way to create laravel project / install Laravel will be directly through composer. Instead of downloading/cloning Laravel from GitHub, you can run the following composer command in terminal/command-prompt:
- Go to your web server root (in Ubuntu, it’s /var/www/)
- Run the following command in terminal:
composer create-project laravel/laravel name-of-your-project
- This will create a directory with name-of-your-project and install Laravel files in it
- This will also install all the required dependencies to run Laravel
- Then, you can simply browse http://localhost/name-of-your-project/public to access Laravel
Share this:
Related posts:
- Laravel: Simple/Easy Installation Guide
- Laravel: Enable Proper Error Display
- Joomla Error – “JFolder::create: Could not create directory” while installing extension
- Hyperledger Fabric: Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
- MySQL Installation Problem: Can’t create pid file – no such file or directory
app/bootstrap.php.cache : failed to open stream: No such file or directory
You probably need to run composer to generate the bootstrap file and download vendors.
In your composer.json you will see a build bootstrap command that gets executed for you.
"post-install-cmd": [ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap" ],
Related videos on Youtube
YuriiChmil
Comments
Warning: require_once(C:\OpenServer\domains\MyBlog.test\web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\OpenServer\domains\MyBlog.test\web\app_dev.php on line 20 Fatal error: require_once(): Failed opening required ‘C:\OpenServer\domains\MyBlog.test\web/../app/bootstrap.php.cache’ (include_path=’.;c:/openserver/modules/php/PHP-5.5;c:/openserver/modules/php/PHP-5.5/PEAR/pear’) in C:\OpenServer\domains\MyBlog.test\web\app_dev.php on line 20
/app/bootstrap.php.cache /var/bootstrap.php.cache /bin/* !bin/console !bin/symfony_requirements
@JoëlSalamin Before that worked for me, I had to add the var directory to extras knpuniversity.com/screencast/symfony3-upgrade/…
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First Run on Command Line: app/bootstrap.php.cache): failed to open stream: #16
First Run on Command Line: app/bootstrap.php.cache): failed to open stream: #16
Comments
Expected Behavior: See list of Commands
Actual Behavior: See vague warning about missing cache file.
$ php app/console PHP Warning: require_once(/path/to/oro/orocommerce-application/app/bootstrap.php.cache): failed to open stream: No such file or directory in /path/to/oro/orocommerce-application/app/console on line 10 PHP Stack trace: PHP 1. () /path/to/oro/orocommerce-application/app/console:0 Warning: require_once(/path/to/oro/orocommerce-application/app/bootstrap.php.cache): failed to open stream: No such file or directory in /path/to/oro/orocommerce-application/app/console on line 10 Call Stack: 0.0002 358608 1. () /path/to/oro/orocommerce-application/app/console:0 PHP Fatal error: require_once(): Failed opening required '/path/to/oro/orocommerce-application/app/bootstrap.php.cache' (include_path='.:/usr/local/php5/lib/php') in /path/to/oro/orocommerce-application/app/console on line 10 PHP Stack trace: PHP 1. () /path/to/oro/orocommerce-application/app/console:0 Fatal error: require_once(): Failed opening required '/path/to/oro/orocommerce-application/app/bootstrap.php.cache' (include_path='.:/usr/local/php5/lib/php') in /path/to/oro/orocommerce-application/app/console on line 10 Call Stack: 0.0002 358608 1. () /path/to/oro/orocommerce-application/app/console:0
The text was updated successfully, but these errors were encountered:
Php – file_put_contents(…/bootstrap/cache/services.json): failed to open stream: No such file or directory
I kept getting this error when running any php artisan commands.
[ErrorException]
file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json): failed to open stream: No suc
h file or directoryHow do I stop that ?
Best Solution
Edit — If the services.json file does not exist, run php artisan serve and then stop to forcibly create the file. See: laravel services.json not created
Edit — updated answer to explain each command.
First, ignore the $ at the beginning of each command. These are to indicate that the commands are executed in Terminal.
To find your username, if you don’t already know it, run:
For me, this would output rob .
Next we want to change the ownership ( chown ) of the services.json file. We set the owner to your username (in my case rob ) and the group to _www , which is the user MAMP runs as.
$ sudo chown rob:_www /Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json
Next we want to change the ownership ( chown ) of the storage directory. We again set the owner to your username (in my case rob ) and the group to _www . You may also notice the -R option. This will execute this command recursively through all of the subdirectories contained within the storage directory.
$ sudo chown -R rob:_www /Applications/MAMP/htdocs/code/bheng/md-bheng/storage
Finally, we want to change the permissions for individual files and directories within the storage directory. The following commands will find within the storage directory, all directories ( -type d ) or all files ( -type f ) and execute the command following -exec .
$ sudo find /Applications/MAMP/htdocs/code/bheng/md-bheng/storage -type d -exec chmod 775 <> \; $ sudo find /Applications/MAMP/htdocs/code/bheng/md-bheng/storage -type f -exec chmod 664 <> \;
The commands we’re executing will change mode ( chmod ) for each directory or file. Read this to learn more about permissions. I’ve linked to Wikipedia, because it’s explains things quite simply. There are likely better resources out there.
Essentially however, 775 will grant read, write and execute permissions on the directories. 664 will grant read and write permissions on the files.