How To Stop Php Server

In this blog post, we’ll demonstrate how to stop a running PHP server. If you’re running a PHP server on your local machine for development purposes, it’s important to know how to stop the server once you’re done working on your project.

Stopping the PHP Server using Terminal or Command Prompt

When running a PHP server, you’ll most likely have it running in a terminal or command prompt window. To stop the PHP server, follow these steps:

  1. Locate the terminal or command prompt window where the PHP server is running. You should see output similar to this:

    PHP 7.4.0 Development Server (http://localhost:8000) started
  2. Press Ctrl + C on your keyboard. This will send a signal to the PHP server process, instructing it to terminate.
  3. You should now see a message similar to the following, indicating that the PHP server has stopped successfully:

    PHP 7.4.0 Development Server (http://localhost:8000) stopped

Stopping the PHP Server using Task Manager or Activity Monitor

If you’re unable to locate the terminal or command prompt window where the PHP server is running, you can stop the PHP server by terminating the PHP process using Task Manager (Windows) or Activity Monitor (Mac). Here’s how:

Windows:

  1. Press Ctrl + Shift + Esc on your keyboard to open the Task Manager.
  2. Click on the “Processes” tab to view a list of running processes.
  3. Locate the php.exe process in the list. You may need to click the “Name” column header to sort the list alphabetically.
  4. Right-click on the php.exe process and select “End task” from the context menu. This will terminate the PHP server process.

Mac:

  1. Press Cmd + Space on your keyboard to open Spotlight search. Type “Activity Monitor” and press Enter to launch the application.
  2. In the Activity Monitor window, you’ll see a list of running processes. Locate the php process in the list.
  3. Select the php process and click the “X” button in the top-left corner of the window. This will open a confirmation dialog.
  4. Click “Quit” or “Force Quit” to terminate the PHP server process.

Conclusion

In this blog post, we showed you how to stop a running PHP server using either the terminal or command prompt window, or by terminating the PHP process using Task Manager or Activity Monitor. Now you can confidently stop your PHP server whenever necessary. Happy coding!