Lilly
Lilly

Reputation: 1

How can I solve the Laravel Server error 500

I set up Laravel. But the 'artisan' didn't work. So I did like this.

*

CCNI@CCNI-WS MINGW64 ~/Cilostan
$ php artisan --version
PHP Warning:  require(C:\Users\CCNI\Cilostan/vendor/autoload.php): failed to ope
n stream: No such file or directory in C:\Users\CCNI\Cilostan\artisan on line 18
PHP Fatal error:  require(): Failed opening required 'C:\Users\CCNI\Cilostan/ven
dor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\CCNI\Cilostan\artis
an on line 18
CCNI@CCNI-WS MINGW64 ~/Cilostan
$ composer dump-autoload
Generating optimized autoload filesClass Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> @php artisan package:discover --ansi
PHP Fatal error:  Uncaught Error: Class 'Illuminate\Foundation\Application' not found in C:\Users\CCNI\Cilostan\bootstrap\app.php:14
Stack trace:
#0 C:\Users\CCNI\Cilostan\artisan(20): require_once()
#1 {main}
  thrown in C:\Users\CCNI\Cilostan\bootstrap\app.php on line 14
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

*

then I did "composer update". The updating was successful. However when I entered the server localhost:8000, the server error 500 occured.

How can I resolve this problem? Help me, please.

Upvotes: 0

Views: 11931

Answers (2)

albus_severus
albus_severus

Reputation: 3702

first try this

composer install

it will import your packages and create vendor folder. If you get error then first run

composer dump-autoload


then

composer install

Upvotes: 0

zlatan
zlatan

Reputation: 3951

As I could see from your error:

PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Application'

Seems like you're missing the mentioned file. The composer is trying to discover some package that has Illuminate\Foundation\Application file, but it can't resolve it, since it might be missing. Check if the file exists, if not, clear your application cache:

php artisan config:clear
php artisan cache:clear
php artisan optimize

After that, try composer dump-autoload again.

If that still doesn't work, clear your application bootstrap cache manually, because it might cache non-exsisting files, which is located in bootsrap/cahce directory. You could see it's trying to locate the file there:

thrown in C:\Users\CCNI\Cilostan\bootstrap\app.php on line 14

So you could delete bootsrap\app.php content as well, or find the mentioned file and delete the line where it is mentioned.

Upvotes: 2

Related Questions