Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@ghost

This comment has been minimized.

Copy link

ghost commented Dec 20, 2016

it worked thanks !!!

@hoomane

This comment has been minimized.

Copy link

hoomane commented Feb 22, 2017

Perfect Man. Thank you so much...

@pcmishra22

This comment has been minimized.

Copy link

pcmishra22 commented Mar 4, 2017

#0 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/home/p...', '/home/prakash/p...', 66, Array)
#1 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(66): require()
#2 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(56): composerRequirea18e6f7b58e96627841f21b104a6506f('b934daf45ecdf2d...', '/home/prakash/p...')
#3 /home/prakash/pivot_survey/vendor/autoload.php(7): ComposerAutoloaderInita18e6f7b58e96627841f21b104a6506f::getLoader()
#4 /home/prakash/pivot_survey/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(17): require_once('/home/prakash/p...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(280): Illuminate\Foundation\Compos in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66
PHP Fatal error: composerRequirea18e6f7b58e96627841f21b104a6506f(): Failed opening required '/home/prakash/pivot_survey/vendor/composer/../pivot/admin/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66

Fatal error: composerRequirea18e6f7b58e96627841f21b104a6506f(): Failed opening required '/home/prakash/pivot_survey/vendor/composer/../pivot/admin/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66

@pcmishra22

This comment has been minimized.

Copy link

pcmishra22 commented Mar 4, 2017

how can i solve my problem?

@musenberg404

This comment has been minimized.

Copy link

musenberg404 commented Apr 11, 2017

Thanks for sharing. It helped me a lot.

@fellydee

This comment has been minimized.

Copy link

fellydee commented Jul 21, 2017

how about using this on a webserver
?

@stevenferrer

This comment has been minimized.

Copy link

stevenferrer commented Aug 26, 2017

Thanks very much 👍

@cstplvishnu

This comment has been minimized.

Copy link

cstplvishnu commented Nov 7, 2017

Awsome dude

@shuvo4054

This comment has been minimized.

Copy link

shuvo4054 commented Dec 5, 2017

Thank's a lot.....

@newsapkota

This comment has been minimized.

Copy link

newsapkota commented Dec 10, 2017

Thanks for info.

@Brennii96

This comment has been minimized.

Copy link

Brennii96 commented Jan 9, 2018

Can't get it working on Windows, gave up and got Linux Mint on Virtual Box.

@rmoddel

This comment has been minimized.

Copy link

rmoddel commented Jan 31, 2018

@hootlex THANK YOU!!!

@lawalthb

This comment has been minimized.

Copy link

lawalthb commented Apr 29, 2018

Thanks

@shafinr23

This comment has been minimized.

Copy link

shafinr23 commented May 22, 2018

thanks it works

@tonoli

This comment has been minimized.

Copy link

tonoli commented Jun 7, 2018

Nice!

@rajucs

This comment has been minimized.

Copy link

rajucs commented Jul 5, 2018

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for doctrine/annotations v1.6.0 -> satisfiable by doctrine/annotations[v1.6.0].
- doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 2
- Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 3
- Installation request for symfony/event-dispatcher v4.0.9 -> satisfiable by symfony/event-dispatcher[v4.0.9].
- symfony/event-dispatcher v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 4
- Installation request for symfony/translation v4.0.9 -> satisfiable by symfony/translation[v4.0.9].
- symfony/translation v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 5
- Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 6
- Installation request for symfony/yaml v4.0.9 -> satisfiable by symfony/yaml[v4.0.9].
- symfony/yaml v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
Problem 7
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
- laravel/framework v5.4.36 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
- Installation request for laravel/framework v5.4.36 -> satisfiable by laravel/framework[v5.4.36].

Note: getting this error should i remove json file?or something else?

@lahirudx

This comment has been minimized.

Copy link

lahirudx commented Aug 6, 2018

I think laragon is easy to use for Laravel Projects
https://laragon.org/

@dextel2

This comment has been minimized.

Copy link

dextel2 commented Aug 28, 2018

@rajucs
Assuming you're running Linux
run
sudo apt-get install php-xml
this shall fix it

@tubauyguner

This comment has been minimized.

Copy link

tubauyguner commented Sep 6, 2018

After making artisan migrate 'base table or view not found and table users doesnt exist'.
What ı should make.

@mc0rt3s

This comment has been minimized.

Copy link

mc0rt3s commented Sep 6, 2018

Thanks a lot !! Works Fine !!

@mehmetcanhoroz

This comment has been minimized.

Copy link

mehmetcanhoroz commented Sep 17, 2018

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for doctrine/annotations v1.6.0 -> satisfiable by doctrine/annotations[v1.6.0].
  • doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 2
  • Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
  • doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 3
  • Installation request for symfony/event-dispatcher v4.0.9 -> satisfiable by symfony/event-dispatcher[v4.0.9].
  • symfony/event-dispatcher v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 4
  • Installation request for symfony/translation v4.0.9 -> satisfiable by symfony/translation[v4.0.9].
  • symfony/translation v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 5
  • Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
  • doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 6
  • Installation request for symfony/yaml v4.0.9 -> satisfiable by symfony/yaml[v4.0.9].
  • symfony/yaml v4.0.9 requires php ^7.1.3 -> your PHP version (7.0.30) does not satisfy that requirement.
    Problem 7
  • doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.30) does not satisfy that requirement.
  • laravel/framework v5.4.36 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
  • Installation request for laravel/framework v5.4.36 -> satisfiable by laravel/framework[v5.4.36].

Note: getting this error should i remove json file?or something else?

As you can see, your php version is lower than requirement. Just update and next time please read error messages (:

@shehzadbrohi

This comment has been minimized.

Copy link

shehzadbrohi commented Sep 20, 2018

Thank you so much.

@atereshhuk

This comment has been minimized.

Copy link

atereshhuk commented Dec 7, 2018

Spent a lot of time searching. Run it in PhpStorm and it work. Thanks

@MaddyGit

This comment has been minimized.

Copy link

MaddyGit commented Dec 9, 2018

Works perfectly:
just a little heads up!
i. cmder might give "Version update information is broken . . . " , it's not a problem you may ignore it or disable 'Check on startup' in "Settings>Main>Update" Issue Closed Here

ii. "php artisan migrate" plunked me with

[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_uniq(email))

if you get hit too then don't worry, solution is this Stackoverflow Answer

Again Thanks to OP! (Y)

@jibolaoseni

This comment has been minimized.

Copy link

jibolaoseni commented Feb 8, 2019

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 :)

#0 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/home/p...', '/home/prakash/p...', 66, Array)
#1 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(66): require()
#2 /home/prakash/pivot_survey/vendor/composer/autoload_real.php(56): composerRequirea18e6f7b58e96627841f21b104a6506f('b934daf45ecdf2d...', '/home/prakash/p...')
#3 /home/prakash/pivot_survey/vendor/autoload.php(7): ComposerAutoloaderInita18e6f7b58e96627841f21b104a6506f::getLoader()
#4 /home/prakash/pivot_survey/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(17): require_once('/home/prakash/p...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(280): Illuminate\Foundation\Compos in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66
PHP Fatal error: composerRequirea18e6f7b58e96627841f21b104a6506f(): Failed opening required '/home/prakash/pivot_survey/vendor/composer/../pivot/admin/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66

Fatal error: composerRequirea18e6f7b58e96627841f21b104a6506f(): Failed opening required '/home/prakash/pivot_survey/vendor/composer/../pivot/admin/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/prakash/pivot_survey/vendor/composer/autoload_real.php on line 66

==========================================================================================

@litanur

This comment has been minimized.

Copy link

litanur commented Mar 21, 2019

Thank you very much. Help me a lot!

@divyeshpatel229

This comment has been minimized.

Copy link

divyeshpatel229 commented May 28, 2019

Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover

In Connection.php line 191:

Undefined index: host

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

@vinitatandulkar

This comment has been minimized.

Copy link

vinitatandulkar commented Jun 30, 2019

Thank you, it's very helpful for me.

@Epignosis0

This comment has been minimized.

Copy link

Epignosis0 commented Jul 8, 2019

but after installing all these things. i now want to start working a github project i downloaded so how do i start doing that

@Epignosis0

This comment has been minimized.

Copy link

Epignosis0 commented Jul 8, 2019

please answer someone anyone

@cnsair

This comment has been minimized.

Copy link

cnsair commented Aug 6, 2019

Good one..

@ThannsokKhen

This comment has been minimized.

Copy link

ThannsokKhen commented Aug 13, 2019

Great one thanks so much you save my day man!!!

@cnsair

This comment has been minimized.

Copy link

cnsair commented Aug 14, 2019

You are very welcome

@Tonislau

This comment has been minimized.

Copy link

Tonislau commented Aug 28, 2019

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.

@shubhamdarekar

This comment has been minimized.

Copy link

shubhamdarekar commented Oct 6, 2019

Thank You helped me a lot

@srn-g

This comment has been minimized.

Copy link

srn-g commented Oct 14, 2019

Thank you..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.