I can't execute php artisan serve on linux - php

Whenever i try to execute php artisan serve command i get this error
PHP Warning: require(/home/mehdi/laravelOrig/vendor/autoload.php):
failed to open stream: No such file or directory in
/home/mehdi/laravelOrig/artisan on line 18
PHP Fatal error: require(): Failed opening required
'/home/mehdi/laravelOrig/vendor/autoload.php'
(include_path='.:/usr/share/php') in /home/mehdi/laravelOrig/artisan
on line 18
I did try some answers i found on google and here but it still wont work , am I missing something ?
Thank you!

First of all install composer on your system and type following command.
1) goto your project directory from command line
2) composer update
3) php artisan serve.

Related

Error while using running chat application in CodeIgniter 4

Downloaded a git repo for a chat application using the below link
Git Repo for Chat Application
Then changed the env file to .env file and also uncommented default database block as shown below.
database.default.hostname = localhost
database.default.database = chat
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi
Then opened terminal and executed this command php spark migrate
But while executing this error pops up
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial> php spark migrate
PHP Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to
open stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open
stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial>
How to resolve this? Any help appreciated.
It looks to me that you didn't run the composer update command after starting the project. So in this case your vendor folder is probably missing a lot of files.
Go to the root of your project in the terminal and run:
$ composer update
And you should be fine.

What reason 'Warning: require(C:\wamp64\www\laravel\bootstrap/../vendor/autoload.php) failed to open stream:

1 I downloaded laravel project from github after install composer
(intalled composer version 1.9.0) and php version in wamp server (PHP 7.3.1)
2 create database and configure db name,username and password(no password) in .env file.
3 After database setup, I used artisan command for database migration:
php artisan migrate
show error message below:
Warning:
require(C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap\autoload.php
on line 17
and this
Fatal error: require(): Failed opening required
'C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap/../vendor/autoload.php'
(include_path='.;C:\php\pear') in
C:\wamp64\www\work\laravel\logistic-management\logistic-master\bootstrap\autoload.php
on line 17
What is the solution for error message.Thanks for advance
Try this : composer update --no-scripts
A stackoverflow question.
If you land with some warnings of PHP versions then you have to use correct php version.

Running "laravel new" command in laravel project

I accidentally ran the laravel new command in a laravel project, which apparently deleted autoload_real.php
I get these error messages when running php artisan serve:
"PHP Warning: require(C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
Warning: require(C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php): failed to open stream: No such file or directory in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\e-commerce\vendor\composer/../symfony/polyfill-ctype/bootstrap.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\e-commerce\vendor\composer\autoload_real.php on line 66"
Is there a way to get back autoload_real.php?
Just run:
composer update
inside your project, it should fix it.
Check if the file actually exists. If it's missing, but the folder 'symfony/polyfill-ctype' is there and empty, try to delete vendor folder and run composer install again. It might be that composer install crashed previous time and it thinks the package is there. That was the case for me.

How to start laravel project that I downloaded from github

I downloaded a project from github but when I try to start with artisan like this:
php artisan serve
I get errors :
PHP Warning:
require(C:\xampp\htdocs\larticles_api/vendor/autoload.php): failed to
open stream: No such file or directory in
C:\xampp\htdocs\larticles_api\arti san on line 18
Warning: require(C:\xampp\htdocs\larticles_api/vendor/autoload.php):
failed to o pen stream: No such file or directory in
C:\xampp\htdocs\larticles_api\artisan o n line 18 PHP Fatal error:
require(): Failed opening required 'C:\xampp\htdocs\larticles_
api/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\l articles_api\artisan on line 18
Fatal error: require(): Failed opening required
'C:\xampp\htdocs\larticles_api/v endor/autoload.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\lartic
les_api\artisan on line 18
1- execute composer install
2- rename .env.example to .env and updated it with your database credentials
3- php artisan key:generate
4- php artisan serve
run composer install, them php artisan serve

Failed opening required file: server.php

I am having the error as shown below using lumen 5.1.
Failed opening required 'C:\xampp\htdocs\sample/server.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0
I am using bash command line and using the php artisan serve. When running the serve on Git Bash I don't get any errors. However when I started to type localhost:8000 in my browser I am getting the above error.
What can I do to solve this?

Categories