php artisan serve can't find the autoload.php - php

SOLUTION: laravel new project-name was actually giving me an error that i overlooked. I had the wrong version of php. It requires phpv7.1.3 or higher. If you don't have it it doesn't work.
Ran into one other problem:
i had a system environment variable that is pointing to an old version of php
Also laravel requires openssl extension and mbstring to turned on. UNCOMMENTED from php.ini
FOR NEWCOMERS: if you have just downloaded php and unzipped the file. It contains a file called
install.txt
that you HAVE to read. It explains everything.
I ran laravel new blog from their getting started page. When I tried to run php artisan serve, I got the following error:
Warning: require(C:\Projects\laravel-projects\blog/vendor/autoload.php): failed to open stream: No such file or directory in C:\Projects\laravel-projects\blog\artisan on line 18
The artisan file is pointing to
require __DIR__.'/vendor/autoload.php';
this directory does not exist. Even if I point it to the correct directory, it still wouldn't work because I don't have read permissions for that folder (so it gets denied).
What's going on, and how can I fix this?
EDIT: changed the url from the mentioned above to:
C:\Users\sarkis\AppData\Roaming\Composer\vendor\autoload.php
This worked perfectly for some reason.
And NOW. A NEW ERROR HAS APPEARED.
Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application' not found in C:\Projects\laravel-projects\blog\bootstrap\app.php:14
Stack trace:#0 C:\Projects\laravel-projects\blog\artisan(21): require_once() #1 {main} thrown in C:\Projects\laravel-projects\blog\bootstrap\app.php on line 14
found that i don't have the proper version of php required.

First Install Composer: composer install.
Then run a command in CMD prompt: composer dump-autoload.

Try running composer dump-autoload , after that run a composer install
If that doesn't work, try the composer update --no-scripts

I'm new to Laravel, and I got the same confusion with the command:
laravel new blog
There was no vendor folder.
But after I tried:
composer create-project --prefer-dist laravel/laravel blog
I found the vendor folder came up.
Don't know why either.

You could try install via Composer Create-Project:
composer create-project --prefer-dist laravel/laravel blog

When running laravel new project_name. It outputted the text php 7.1.3 or higher needs to be installed. Current version 5.6 does not match requirements. And it aborts without plainly giving you an error. Be sure to download php version 7.1.3 or higher. Also check if you have environment variables for earlier versions of php and delete those.
note: be sure to read install.txt from the php download

Check all your permissions to following folders and give 0777 permissions
storage 0777
vendor 0777
bootstrap/cache 0777
And then run again
php artisan serve

Related

Laravel 5.4.* - The "" directory does not exist when running artisan

I have a fresh installation of Ubuntu Server 14.04 in which I'm currently trying to install my Laravel project on.
I have moved the entire repository into the folder required, but when I run the command
php artisan
within that directory, the terminal returns an error stating
[InvalidArgumentException]
The "" directory does not exist.
Does anyone know what I can possibly do to solve this issue?
I had this same issue and it turned out that I was not cloning the ./config directory because of a poorly defined .gitignore. So make sure the original project location was able to push that directory up and that it exists in the new location.
After the clone I re-ran composer install and it all worked.
I had been facing the same issue and I found that there was an empty folder in Module Directory. I had just deleted that Module Directory and again started with new Module Directory and it had solved the problem.
Same issue, resolved it by running php artisan config:cache
in my case, i run composer install and it through below error
Problem 1
- lcobucci/jwt is locked to version 4.1.4 and an update of this package was not requested.
then I run
composer update
and it worked like a charm.

error using composer to install cakePHP 3

i am lost...
i am trying to do it the right way and am following the Quick Start Guide for installing cakePHP 3 on my ubuntu machine.
Got composer installed. Directory is /var/www/cakephp
and am trying to issue:
php composer.phar create-project --prefer-dist cakephp/app mayapp
or
composer create-project --prefer-dist cakephp/app may app
then i am simply getting:
[InvalidArgumentException]
Could not find package cakephp/app with stability stable.
i do not have a clue what i am doing wrong. Any suggestions?
cakephp/app exists on https://packagist.org, and the command looks ok to me.
Which PHP version are you using? That package is only available with PHP 5.4.16 or later, so you must update if you want to use CakePHP.
However, it is a good idea to only use the same PHP version of your public hosting, using a newer version will lead to problems when deploying your code. If your webspace or public server does not have the latest PHP 5.6 running, ask for an update.
I got same issue. But, as previous answer, myapp does not exists on packagist.org, so, you must use laravel/laravel instead, and, after created, rename the new laravel folder to your desired name and move to htdocs (for xampp) or www (for wamp), then, and I do not know why, go to : localhost/laravel/public/
and replace laravel with the name you gave to your project folder instead the laravel one.
You will see Laravel 5 fonts will appear on screen.
That's means Laravel is running.
Hey Please try these steps.
Download XAMPP Server.
Install XAMPP server.
Go to ..\xampp\php\php.ini and open.
Add this line (extension=php_intl.dll) or if exist uncomment.
Download Composer setup from https://github.com/composer/windows-setup/releases/
Install composer and give php.exe file in path
Open cmd and check now php version using command php -v. if its showing php version its means its working.
Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
Finished folder created in htdocs.
Hope this is helpful for you.

Failure to find autoload.php

I'm stuck on a very basic problem:
I'm trying to use Laravel, which I installed on my windows 7 with composer.
When I try to access my website locally with Wamp, I get the error:
Warning:
require(C:\wamp\www\sitedirectory\public\protected\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\wamp\www\sitedirectory\public\protected\bootstrap\autoload.php on
line 17
Everywhere I can read that all I have to do is run composer install or update.
The problem is that I did run both and nothing has to be updated.
The files are where they are needed so I dont understand what could be the problem.
Does anyone have an idea of what could be my problem?
Thank you in advance.
Composer is a tool for managing and installing dependencies.
There should exist a file named composer.phar in the directory C:\wamp\www\sitedirectory\public\protected\. There you should execute the command composer.phar install (on the command line).
Then, the directory vendor containing the autoload.php etc. should be generated.
If the composer.phar does not exist (but at least a file named composer.json), follow the steps explained here to download composer.

Laravel error in /bootstrap/start.php: \Illuminate\Foundation\Application not found

So, I installed Laravel on a dev server (php5.5.3, standard installation, mcrypt installed), and I get the following error message:
Fatal error: Class 'Illuminate\Foundation\Application' not found in /[path_to_laravel_app]/bootstrap/start.php on line 14
Quite odd, and I haven't seen a solution to this file, although I've seen plenty of similar errors. Any advice welcome. Thanks!
/bootstrap/start.php is created after composer install by running Laravel's php artisan optimize. I've had a lot of issues on this during upgrades of Laravel, but removing /bootstrap/start.php, composer.lock, and the vendor directory and re-running composer install should fix this issue.
Run this command:
composer update --no-scripts
In my case I have added another required package(Guzzle) in the compser.json file separately(in the last line but it should be after the laravel package line) and updated the compsoser and came across this issue.
I have checked and my vendor/laravel folder has gone. That was preventing me to run any artisian command.
So "--no-scripts" worked for me as it prevents any scripts to be included before executing artisan.
You can use another method in case you are having issues.
Install another raw laravel and copy all the files from the vendor
file to your old repostory.
Change permission of storage and bootstrap folder to 775 or 777.
Delete everything in the session and view folder of storage/framework
Correct the composer.json. This might happen after you have added a new package configuration by dublicating the require tag.
Do not create yet another
require: {
..
}
use the previous defined one.
Then follow the accepted answer to re-install the packages.
Just Run the command
composer install --no-scripts
Or,
composer update --no-scripts
Double check your composer.json file. If you have error on "require": section this error will occur.
Just restore a previous version of composer.json file and run composer update.

Unable to update Laravel 4 with Composer (Update: bug?)

Today, I pulled down the laravel/laravel repository from Github. I then ran php composer.phar install (as I normally would on my system, with a command window in the project directory). However, when I ran php composer.phar update, I received this error:
Everything installed just fine, and Laravel works as it should.
Any ideas what could be causing this issue?
Edit 1
artisan exists in the root of the project, but it throws an exception when I attempt to run php artisan optimize:
Side Note 1
If I try the alternative method (quicker) of installing Laravel (php composer.phar create-project laravel/laravel), I get the following:
Edit 2
Upon installation, I also get the same error, where it claims it cannot find artisan. Therefore, the installation does not fully complete. I believe that it is stopping when it wants to compile classes (or something to that effect), and then write bootstrap/compiled.php. That file doesn't exist.
Here's the snap from the install:
Edit 3
It seems that Composer is looking for artisan in the drive root (C:\). Why is it doing this? Even if I specify -d on the update, it throws the error. (I picked this up from a hunch - simply copied artisan to the root of the drive and it found it - albeit, it obviously did not run...)
Solution Found:
Composer makes calls to php artisan <command> (as per the instruction in composer.json > scripts), but it does not see what directory it is running from (perhaps because it is an external command?).
So, I solved my initial problem by using an absolute path to artisan in composer.json.
Everything is working now. I just wish I knew how to get Composer to know that it is running from C:\LocalServer\lab\laravel, and not just C:\.
As i can see, your artisan file is missing. Can you post the exact steps on how you install it ?
Also, please follow http://laravel.com/docs/installation and http://niallobrien.me/2013/03/installing-and-updating-laravel-4/
I had this problem today too. My laravel folder inside the vendor was deleted after composer update. I ran composer install again and problem resolved.

Categories