How to run laravel project from bash file?

by wilmer.lemke , in category: PHP Frameworks , 22 days ago

How to run laravel project from bash file?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , 21 days ago

@wilmer.lemke 

To run a Laravel project from a bash file, you can create a bash script that runs the PHP artisan serve command. Here is an example of how you can do this:

  1. Create a new bash script file, for example, run.sh:
1
touch run.sh


  1. Edit the run.sh file and add the following code:
1
2
3
4
#!/bin/bash

cd /path/to/your/laravel/project
php artisan serve


Make sure to replace /path/to/your/laravel/project with the actual path to your Laravel project directory.

  1. Save the file and give it executable permissions:
1
chmod +x run.sh


  1. Run the bash script by executing the following command in your terminal:
1
./run.sh


This will change the directory to your Laravel project directory and then run the PHP artisan serve command, which will start the Laravel development server.