Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

yossi's avatar
Level 2

How to clone and run new dev environment

hi, my project is in laravel 8, with sail, running on wsl2/ubuntu. i'm using github to manage my project. and now i want to create another dev station with same OS.

what are the steps?

  1. i installed docker
  2. i have latest composer
  3. php ver 8.0.28

I cloned the project to a local folder, and.. what's next?

i saw this script in the docs, but it fails:

docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs

the error: [...........] 59/118 [==============>-------------] 50% 74/118 [=================>----------] 62% 84/118 [===================>--------] 71% 100/118 [=======================>----] 84% 113/118 [==========================>-] 95% 118/118 [============================] 100% Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi

   Illuminate\Database\QueryException

  could not find driver (SQL: select * from `categories`)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:759
	755▕         // If an exception occurs when attempting to run a query, we'll format the error
	756▕         // message to include the bindings with SQL, which will make this exception a
	757▕         // lot more helpful to the developer instead of just the database's errors.
	758▕         catch (Exception $e) {
  ➜ 759▕             throw new QueryException(
	760▕                 $query, $this->prepareBindings($bindings), $e
	761▕             );
	762▕         }
	763▕     }

  1   [internal]:0
	  Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider))

	  +20 vendor frames
  22  app/Providers/AppServiceProvider.php:33
	  Illuminate\Database\Eloquent\Model::all()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
0 likes
1 reply
LaryAI's avatar
Level 58

After cloning the project to a local folder, the next step is to run the Laravel Sail command to start the development environment. The error message suggests that there is a missing database driver. To fix this, the user needs to install the necessary database driver for their system.

Here are the steps to clone and run a new dev environment:

  1. Clone the project to a local folder using Git.
  2. Install Docker and make sure it is running.
  3. Install the necessary PHP version and Composer.
  4. Open a terminal and navigate to the project folder.
  5. Run the following command to start the development environment:
./vendor/bin/sail up
  1. Once the environment is up and running, open a new terminal window and navigate to the project folder.
  2. Run the following command to install the project dependencies:
./vendor/bin/sail composer install
  1. Run the following command to generate a new application key:
./vendor/bin/sail artisan key:generate
  1. Run the following command to run the database migrations:
./vendor/bin/sail artisan migrate
  1. If the user encounters a missing database driver error, they need to install the necessary driver for their system. For example, if the error message is "could not find driver", the user needs to install the PHP MySQL driver. On Ubuntu, the user can run the following command to install the driver:
sudo apt-get install php8.0-mysql
  1. Once the necessary driver is installed, the user can run the database migrations again:
./vendor/bin/sail artisan migrate
  1. The user can now access the project in their web browser at http://localhost.

Please or to participate in this conversation.