PHP 8.0.0 comes with a integrated development server. It may be used to run applications without having to put in a manufacturing HTTP server along with nginx or Apache. The integrated server is best designed to be used for development and checking out purposes.
It can be began by using the -S flag:
php -S <host/ip>:<port>
1. Create an index.php file containing:
<?php echo "Hello World from built-in PHP server";
2. Run the command php -S localhost:8080 from the command line. Do now not include http://
This will start a web server listening on port 8080 the usage of the present day directory that you are in as the document root.
3. Open the browser and navigate to http://localhost:8080. You need to see your “Hello World” page.
To override the default document root (i.e. the current directory), use the -t flag:
php -S <host/ip>:<port> -t <directory>
E.G. when you have a public/ listing in your task you can serve your undertaking from that directory using php -S localhost:8080 -t public/.
Every time a request is crafted from the improvement server, a log entry like the one underneath is written to the command line.