Is there a quick and easy way to run a php server/website with node

I have few php websites which I wanted to video, instead of turning on MAMP, I was wondering if there was a way to do this with node.

I found one solution called node-php-server. Ir works fine to load the index file, but it doesn’t loaf css or images.

But over all that is the kind of thing I am looking for

You should use an established PHP, like Apache or PHP-FPM. Not NodeJS.

It does sound interesting, even if doubtful.

I mean, PHP is written in C

So does the JavaScript work with the C code, or parse PHP code into JavaScript code, or what?
(Sorry, too busy to look into it more ATM)

Seems at best it wold be introducing a “middle” that doesn’t need to be there, and for what purpose?

That’s true, but I just need a quick and dirty way of seeing few php files up in the browser. With the link I posted in the question I nearly accomplished what I needed, so it’s doable. I don’t want it for professional/development reasons, just to check through some old projects

So you mean to see the PHP code but not run it?

I mean a simple php server

It sounds like it would be rather simpler to use am _x_AMP server of some flavour. Something like The Uniform Server can even be run off a memory stick if need be, making it very portable. It also means it doesn’t have to be installed as such; once you remove the memory stick, all trace of it is gone from the host machine.

1 Like

I have mamp installed on my mac. Though the idea of running `node server.js" or some such and see the site live, just sounds easier. It obviously taking some time to fined the right method. But I don’t know why I think this way would be easier.

I hoped someone might know the right npm package that does this.

A simple JavaScript server is not the same thing as a simple PHP server.

1 Like

I sometimes use PHP’s built-in web server to test sites from my development computer. From the project’s directory I just use php -S localhost:8080 to start serving files. The docs have more information on this.

1 Like

Clearly!

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