phplaravel-5.5

Run laravel project in localhost


I have installed laravel by composer create-project laravel/laravel –-prefer-dist

after this run php artisan serve command to laravel project directory and get this result.

Laravel development server started: http://127.0.0.1:8000

But when i go to http://127.0.0.1:8000 in browser laravel project not running and give error

This site can’t be reached 127.0.0.1 refused to connect.

but http://localhost/laravel/public/ it is working. Can anyone tell me that what is proper way to run this laravel project.


Solution

  • Try to run in different port

    php artisan serve --port=9000

    and then try http://127.0.0.1:9000 will work.

    As might be on port 8000 something already running on your system will not make it work.

    And you can also run your laravel project without artisan serve command

    If anyone wants to make the application public, the more easy and fastest way is:

    1. Rename the "server.php" file in root directory, in "index.php"
    2. Move your .htaccess from public folder to root directory
    3. Make your directory accessible to Apache2 (set all file permissions to 777).