0

The situation is simple: I have a PHP file and I want to serve it on my localhost. I already have MySQL set up and don't want to install XAMPP or other bulky packages which come with their own MySQL or any other thing such as that.

I tried many Node.js ways to serve a PHP file but none worked for me.

Please, I just have a file and want to "run" it. How can I do that?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
aleksandar
  • 183
  • 3
  • 11
  • 2
    Install a webserver (e.g. apache or nginx) and configure them to serve PHP files (likely requires additional software, in particular PHP). – Felix Kling Dec 13 '16 at 22:59
  • Consider info here: http://stackoverflow.com/questions/21495733/is-there-any-way-to-test-php-locally-without-installing-a-server – MeltingDog Dec 13 '16 at 22:59
  • http://stackoverflow.com/questions/6542169/execute-php-scripts-within-node-js-web-server – Adiii Dec 14 '16 at 02:46
  • What "Node.js ways to serve a PHP file" did you try? As far as I know that's not possible. Node.js is for JavaScript, not PHP. – ChrisGPT was on strike Dec 14 '16 at 09:03

2 Answers2

0

First of all nodeJS means nodeJavaScript. So it will not support php with mystery magical things.

You could only install Apache server and mySQL. Then you don´t need any XAMPP and the tools it brings with it. Try to install Apache standalone.

Not sure if this works but should be no problem.

But all in all i would recommend you to use XAMPP

0

Unfortunately, if you want to run a "server-side" code (in your case PHP) in your Windows computer, you have to use a web server that simulate for you it.

XAMPP (or WAMP) enables localhost port to receive connections from yourself and it is a smart way to try in "local" your code. If you want to run PHP but you don't want to install XAMPP, then you can install a linux distribution and run "apache HTTP server" that is already installed in most distributions. But in every case you need a tool to simulate the "server-side" part.

Fabrizio A.
  • 64
  • 1
  • 8