Mustafa Poya
Mustafa Poya

Reputation: 3027

Running php artisan serve command with different php versions

I have a Laravel 5.6 Project which is running with PHP Version 7.10 and another Laravel 7.x project with PHP version 7.4. I defined the PHP path in Windows 10 Environment Variable and every time I have to change the PHP Environment Variable to run each project.

any solution to prevent from this redundant work?

Upvotes: 4

Views: 7672

Answers (2)

Waqas
Waqas

Reputation: 162

For Windows Xampp. you can set path like this. in my case xampp is in "C" drive.

/c/xampp/php/php.exe artisan serve

Upvotes: 1

Mustafa Poya
Mustafa Poya

Reputation: 3027

For Windows:

to run different projects with its required PHP version you can include the required PHP path before writing artisan serve:

C:\wamp64\bin\php\php7.0.33\php.exe artisan serve --host=127.0.0.1 --port=8000
C:\wamp64\bin\php\php7.4.9\php.exe artisan serve --host=127.0.0.1 --port=8500

For Linux (Ubuntu):

/usr/bin/php8.0 artisan serve --host=127.0.0.1 --port=8000

Upvotes: 11

Related Questions