How to run a PHP server on your pc! (Using PHP webserver)

How to run a PHP server on your pc

(This only works for Windows PCs)

This is for running PHP locally on your PC, not for InfinityFree’s online servers.

  1. Download Thread Safe PHP from PHP.
  2. Extract the .zip the site give you (in a folder like C:/php), now make a index.html or index.php and put the code you want in it.
  3. Running the server. Go to Command Prompt in the folder and run this cmd:
    “The-PATH-to-PHP.exe” -S localhost:8000 and boom your local server is online (only for you).
  4. (Optional) If you on windows you can make a .bat file in the .bat file you can put:
    @echo off
    “The-PATH-to-PHP.exe” -S localhost:8000
    pause

Not a public server — good for dev but not for live sites.

The end!

(Yeah, I know this isn’t exactly an InfinityFree thing, but hey — someone will find it useful.)

If this method works for you, then great! However, there are a few things to note:

  • This only works for Windows PCs. Computers running MacOS, Linux or something else don’t work as is.
  • Using the PHP built-in webserver lets you run PHP, yes. But I think most people have more use for something like XAMPP or WampServer, which also include Apache and MySQL, which are helpful if you actually want to run a full website like you would on our hosting.
8 Likes

I now am using XAMPP but it got corrupted. And so is the PHP web server to (NOT XAMPP web server). I redownload the PHP and it got corrupted so now I making my own PHP web server using python :smiley:.


use https://online-barcode-reader.inliteresearch.com/ to read it.

For the people that don’t want to scan/read the barcode, it goes to http://tinyurl.com/htrapws, which then goes to https://forum.infinityfree.com/t/how-to-run-a-php-server-on-your-pc-using-php-webserver/116860/3?u=gavin12342

5 Likes

so… he posted a barcode, in this thread, that takes you back to this thread?

I’m confused

6 Likes

I honestly don’t know either. A barcode was random by itself, but one that goes back to the forum is even more random.

At least I’m not the only one wondering this.

4 Likes

just use xampp

That’s cool I guess?

Yes, you can encode arbitrary data with barcodes. They’re no different from QR codes in that sense, except that barcodes are more primitive and people don’t expect to find an encoded URL in there.

What is the point of it? I don’t know, practically it seems like a worse alternative to QR codes in every way.

What does it have to do with this topic? Absolutely nothing.

5 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.