Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running php artisan serve command with different php versions

Tags:

php

laravel

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?

like image 746
Mustafa Poya Avatar asked Oct 27 '25 10:10

Mustafa Poya


1 Answers

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
like image 59
Mustafa Poya Avatar answered Oct 30 '25 01:10

Mustafa Poya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!