Use PHP's Built-in Web Server for Quick Development

Use PHP's Built-in Web Server for Quick Development

PHP comes with a built-in web server that's perfect for local development and testing. It's especially useful for small projects or when you need to quickly test something.

To start the server, navigate to your project directory in the terminal and run:

php -S localhost:8000

If you want to serve a specific directory (e.g., 'public'), use:

php -S localhost:8000 -t public/

This starts a web server at http://localhost:8000. It's not meant for production use but is excellent for development and testing purposes.

← Back to Tips List