PHP and node.js on the same server

one text

Solution:

After much much research, trial and error I've figured out a few things.

My site consists of mainly PHP, I want to use node.js on a separate page as a chat app. I thought this would be easy, but I was mistaken. It's a lot of pain to get both node.js and PHP to work together flawlessly, and if I knew back then what I know now I might have went a different route. But I have things working for the most part and I am happy.

Some useful info:

If you want to link back to 80 or 443 from your node page, use the full URL with http/s.

If you want to use a virtual host it's only possible on Apache 2.4+ because socket.io can't communicate through it without some apaache mods that allow websocket proxing. It's also possible with NGINX from what I hear but I am less familiar with it.

So in the end I am just keeping the port number and allowing hyper links between the two. This is a temporary solution until I upgrade to either Apache 2.4 or NGINX.

Source