I am new to PHP and Laravel. While virtualhosting with Wamp, I could specify the documentroot, servername and the port number - hence specifying the domain name. But with the command php artisan serve, I am able to specify the port address but not the domain name. Is it possible to set the domain name?
also, what is the difference between hosting with this command and with wamp ?
n.b I am new to server side languages, sorry for asking these basics !
EDIT: I've used php artisan serve --host=blog.local --port=8001 but error is showing up
I've cleared the configuration and application cache.
The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.
It's located at /etc/hosts on Mac or Linux alternatively you can find it at C:\Windows\System32\drivers\etc\hosts on Windows. You will need administrator rights to change this. You can change the something.com to the domains you want to use.
To set the "php artisan serve" command port number to anything other than 8080 you can specify the port number using the "--port" flag and then specify the port number.
Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.
You can explicitly define the host and the port with artisan serve command:
php artisan serve --host=somedomain.com --port=8001
Note: Remember to enable to port with your firewall.
Though it is too late.
Make an entry in the system host file. in case of windows it is at
C:\Windows\System32\Drivers\etc\hosts
# localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 blog.local
Then run your command:
php artisan serve --host=blog.local --port=8001
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With