How To Use The PHP Built-in Web Server Updated on June 7, 2023 by Christopher Maiorana 1 Minutes, 18 Seconds to Read Have you ever tried to open a PHP file locally? You may have noticed your web browser does not process PHP code naturally. You need a web server in order to do that. If you’re unfamiliar with PHP web hosting, you can check out a free PHP tutorial to brush up on your scripting skills. Why Use The PHP Built-in Server Using the PHP Built-in Server Why Use The PHP Built-in Server The built-in PHP web server can be run on any computer that has PHP installed. (Apple computers already have PHP installed, but if you’re on Windows or Linux you may need to run a PHP installer.) The PHP built-in server is used to aid in writing PHP scripts without having to run a full stack web server. But it should not be used for local WordPress development or for a production website. The built-in PHP server lets you quickly and easily test a PHP script for educational or development purposes. For something more advanced, you will want to look into installing a local development environment or purchasing shared hosting. Using the PHP Built-in Server In order to use the PHP built-in server you’ll need to open your computer’s terminal app and have a PHP file available to work with. Using your terminal app, navigate to the folder where your PHP file resides and run this command: $ php -S localhost:8000 You’ll notice this binds a sort of pop-up web server you can access by going to the localhost:8000 URL in your web browser. And your PHP scripts will execute as needed. Share this Article CM Christopher Maiorana Content Writer II Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog. More Articles by Christopher Related Articles How To Create a PHP Redirect (301, 302, and Dynamic Redirect Examples) Connect to SFTP for Shared Hosting Accounts Using FileZilla FTP Basics for Dedicated Servers How to Install Jekyll and Launch a New Site How to Host AI-Prompt Generated Websites on Shared Hosting What is your default PHP.ini file? Getting Started Guide: FTP Configuring your site in WS_FTP Schedule Social Media Posts With Buffer FTP Error – 421 Too Many Connections