Skip to content

Instantly share code, notes, and snippets.

@hootlex
Last active February 23, 2024 04:26
Star You must be signed in to star a gist
Save hootlex/da59b91c628a6688ceb1 to your computer and use it in GitHub Desktop.
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
  • Download composer https://getcomposer.org/download/
  • Pull Laravel/php project from git provider.
  • Rename .env.example file to .envinside your project root and fill the database information. (windows wont let you do it, so you have to open your console cd your project root directory and run mv .env.example .env )
  • Open the console and cd your project root directory
  • Run composer install or php composer.phar install
  • Run php artisan key:generate
  • Run php artisan migrate
  • Run php artisan db:seed to run seeders, if any.
  • Run php artisan serve

#####You can now access your project at localhost:8000 :)

If for some reason your project stop working do these:

  • composer install
  • php artisan migrate
@CharlyCeballos
Copy link

CharlyCeballos commented Dec 12, 2020

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for cocur/slugify v3.2 -> satisfiable by cocur/slugify[v3.2].
  • cocur/slugify v3.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 2
  • Installation request for erusev/parsedown 1.7.3 -> satisfiable by erusev/parsedown[1.7.3].
  • erusev/parsedown 1.7.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 3
  • Installation request for laravel/framework v5.8.17 -> satisfiable by laravel/framework[v5.8.17].
  • laravel/framework v5.8.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 4
  • Installation request for nicolaslopezj/searchable 1.10.4 -> satisfiable by nicolaslopezj/searchable[1.10.4].
  • nicolaslopezj/searchable 1.10.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 5
  • Installation request for webonyx/graphql-php v0.13.4 -> satisfiable by webonyx/graphql-php[v0.13.4].
  • webonyx/graphql-php v0.13.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 6
  • Installation request for phpunit/phpunit 7.5.11 -> satisfiable by phpunit/phpunit[7.5.11].
  • phpunit/phpunit 7.5.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    Problem 7
  • cocur/slugify v3.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  • cviebrock/eloquent-sluggable 4.8.0 requires cocur/slugify ^3.1 -> satisfiable by cocur/slugify[v3.2].
  • Installation request for cviebrock/eloquent-sluggable 4.8.0 -> satisfiable by cviebrock/eloquent-sluggable[4.8.0].

To enable extensions, verify that they are enabled in your .ini files:

  • /etc/php/7.2/cli/php.ini
  • /etc/php/7.2/cli/conf.d/10-mysqlnd.ini
  • /etc/php/7.2/cli/conf.d/10-opcache.ini
  • /etc/php/7.2/cli/conf.d/10-pdo.ini
  • /etc/php/7.2/cli/conf.d/15-xml.ini
  • /etc/php/7.2/cli/conf.d/20-calendar.ini
  • /etc/php/7.2/cli/conf.d/20-ctype.ini
  • /etc/php/7.2/cli/conf.d/20-dom.ini
  • /etc/php/7.2/cli/conf.d/20-exif.ini
  • /etc/php/7.2/cli/conf.d/20-fileinfo.ini
  • /etc/php/7.2/cli/conf.d/20-ftp.ini
  • /etc/php/7.2/cli/conf.d/20-gettext.ini
  • /etc/php/7.2/cli/conf.d/20-iconv.ini
  • /etc/php/7.2/cli/conf.d/20-json.ini
  • /etc/php/7.2/cli/conf.d/20-mysqli.ini
  • /etc/php/7.2/cli/conf.d/20-pdo_mysql.ini
  • /etc/php/7.2/cli/conf.d/20-phar.ini
  • /etc/php/7.2/cli/conf.d/20-posix.ini
  • /etc/php/7.2/cli/conf.d/20-readline.ini
  • /etc/php/7.2/cli/conf.d/20-shmop.ini
  • /etc/php/7.2/cli/conf.d/20-simplexml.ini
  • /etc/php/7.2/cli/conf.d/20-sockets.ini
  • /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
  • /etc/php/7.2/cli/conf.d/20-sysvsem.ini
  • /etc/php/7.2/cli/conf.d/20-sysvshm.ini
  • /etc/php/7.2/cli/conf.d/20-tokenizer.ini
  • /etc/php/7.2/cli/conf.d/20-wddx.ini
  • /etc/php/7.2/cli/conf.d/20-xmlreader.ini
  • /etc/php/7.2/cli/conf.d/20-xmlwriter.ini
  • /etc/php/7.2/cli/conf.d/20-xsl.ini
  • /etc/php/7.2/cli/conf.d/20-zip.ini
    You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Some one can help.

@ghost You can run composer install --ignore-platform-reqs

@althafh98
Copy link

Screenshot (78)
When I update the composer this error will come. How can I fix this error ?

@freakingud
Copy link

Thanks a lot! Was stuck on this for so long!

@bsanjarbek
Copy link

Thanks a lot!

@xtniloy
Copy link

xtniloy commented Jun 17, 2021

If this is a new installation, you need to run composer install

If it's an existing installation (vendor folder exists) run composer update

@ugintl
Copy link

ugintl commented Aug 16, 2021

@xtniloy I have a factories folder as well. what php artisan command I should run?

@pluthra23
Copy link

pluthra23 commented Nov 29, 2021

Screenshot (78) When I update the composer this error will come. How can I fix this error ?

Just use another directory and use any terminal to. Laravel can be installed into any directory after you create it, using the command below.

Download composer using this link: https://getcomposer.org/Composer-Setup.exe

It will install the composer for global usage. Then use command prompt or cmd.exe to execute below commands

composer create-project laravel/laravel projectname

It will install dependencies and you'd be able to run the server by going to the root directory of this project.

cd root directory which you just created

php artisan serv

Copy link

ghost commented Dec 18, 2021

It works. Thank you so much

@macojaune
Copy link

Thanks a lot !

@collinmuk
Copy link

./composer.json" does not match the expected JSON schema:

  • type : Does not match the regex pattern ^[a-z0-9-]+$

@Ahamed-Rashad
Copy link

thank you

@shakziaurrahmantito
Copy link

Thanks a lot of

@gadoma2022
Copy link

ErrorException
require(C:\xampp\htdocs\cassation\routes\api.php): failed to open stream: No such file or directory

@bbaheer1
Copy link

Hello I Followed these ways that you mentioned but I got an error (PHP Warning: require(C:\Users\BB\Downloads\RMZ-main\RMZ-main/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan on line 18

Warning: require(C:\Users\BB\Downloads\RMZ-main\RMZ-main/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan on line 18
PHP Fatal error: Uncaught Error: Failed opening required 'C:\Users\BB\Downloads\RMZ-main\RMZ-main/vendor/autoload.php' (include_path='F:\xampp\php\PEAR') in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan on line 18

Fatal error: Uncaught Error: Failed opening required 'C:\Users\BB\Downloads\RMZ-main\RMZ-main/vendor/autoload.php' (include_path='F:\xampp\php\PEAR') in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\BB\Downloads\RMZ-main\RMZ-main\artisan on line 18
PS C:\Users\BB\Downloads\RMZ-main\RMZ-main> )

@MuneneMutuma
Copy link

Thank you!

@vijendrarc
Copy link

Warning: require(C:\xampp\htdocs\laravel\crudapp\public/laravel_project/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravel\crudapp\public\index.php on line 25

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\laravel\crudapp\public/laravel_project/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\laravel\crudapp\public\index.php on line 25

@ahtashamilyas
Copy link

Got this error "PHP Warning: require(C:\Users\ahtasham\OneDrive\Desktop\Laravel\first/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan on line 18

Warning: require(C:\Users\ahtasham\OneDrive\Desktop\Laravel\first/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan on line 18
PHP Fatal error: Uncaught Error: Failed opening required 'C:\Users\ahtasham\OneDrive\Desktop\Laravel\first/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan on line 18

Fatal error: Uncaught Error: Failed opening required 'C:\Users\ahtasham\OneDrive\Desktop\Laravel\first/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\ahtasham\OneDrive\Desktop\Laravel\first\artisan on line 18" after running this command "php artisan serve".

@Judekiing
Copy link

Thanks, this has been very resourceful

@fan0512
Copy link

fan0512 commented Aug 31, 2023

Thank you.
Your github was helpful for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment