How to launch a PHP website on macOS?

Recently I got the source code of a simple PHP website. Obviously I’m not a PHP developer. However, I’m curious on how to launch the website on my MacBook. In searching, I found a simple way to launch a PHP website on macOS using its in-built PHP server. This may not be a solution for someone to develop and debug PHP websites. But, it will help you to check basic PHP websites and web pages.

Tools Used

  • PHP 7
  • macOS Big Sur

Start the PHP server

First, start the inbuilt PHP server by following these steps:

  1. In the finder, go to the folder with the php website code.
    open terminal from the folder
  2. Right click the folder. From the popup menu, select the option New Terminal at Folder to launch the terminal window for the folder.
  3. In the terminal window run the command php -S localhost:9000.
  4. The server starts listening to http://localhost:9000. Just leave the terminal window without disturbing it. Once you close the terminal, the server will stop running.
Start the PHP server on macOS

Launch the PHP website

Now, go to any browser and run the address http://localhost:9000/. If the folder has an index.php file, then it will load the webpage. Else, you have to add the webpage name to the url like http://localhost:9000/something.php.

Launch A PHP Website On MacOS

Shutting down the PHP server

Go back to the terminal window and press Ctrl + C buttons to shut down the PHP server. Then you can quit the terminal.

Hope this article will help you to quickly run or launch a PHP website on macOS.


  • More about using PHP on macOS at

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.