0

I am working on a web app where some of the existing code is in PHP, but much of the new development is going to be in Node.js. The backend is MySQL. In the past I've used MAMP for the LAMP stack. However what would you suggest using as a local development environment for Node.js, PHP, & MySQL?

Thank you,

2
  • Install Node Server and for mysql with node you just need to install mysql module for nodejs and for php you already have MAMP Commented Feb 1, 2016 at 4:42
  • @Haridarshan Would I run the Node.js and MAMP on different ports or the same? Commented Feb 1, 2016 at 23:31

2 Answers 2

1

You can Node server on any port you want which is available using Node Express module

var app = require('express')();

var listener = app.listen(<Available_Port>, function(){
    console.log('Listening on port ' + listener.address().port); 
});

MAMP apache will run on 80 port by default, from where your php scripts will gets executed and Mysql on port 3306 by default

Sign up to request clarification or add additional context in comments.

Comments

0

Several packages can help you serve PHP through Node, most notably the node-php packages (there's two of them, completely unrelated to each other but generally does the same job).

Here's a sample of Node serving WordPress using mkschreder's node-php:

var express = require('express');
var php = require("node-php"); 
var path = require("path"); 

var app = express();

app.use("/", php.cgi("/path/to/wordpress")); 

app.listen(9090);

console.log("Server listening!"); 

Ideally though, you should stick to either just Node or PHP. Node operates server-side, so does PHP. Putting PHP on a Node project makes Node redundant, and vice versa.

Further reading:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.