How to Run Php on Local Computer?

How to Run Php on Local Computer?

This is driving me nuts because it seems like such a critical thing that I would expect there to be a lot of people asking, but I can't find a clear cur response to.

I want to follow along a simple php tutorial like this one:

I installed everything I need. Now what? How do I run a php file?

9

1 Answer

Okay, so here's the simple answer I would have loved to find but couldn't

  1. cd into the directory the file is in

  2. Run php -S localhost:8000 (or replace 8000 with a different port)

  3. Go to localhost:8000 in the browser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.