nodejs / node-v0.x-archive

Moved to https://github.com/nodejs/node
34.43k stars 7.31k forks source link

App not running when loaded on a PHP page, how come? #1235

Closed kfa1983 closed 13 years ago

kfa1983 commented 13 years ago

Hey guys,

I got some MIME problem I think but I have a well-working app that runs on nodeJS... I ran a few tests of my app with text/HTML (index.html) but when I tried to change it to application/x-httpd-PHP (index.php) to add even more variables, the page doesn't load and get downloaded xD

Any clue how to solve this?

Thanks in advance!

bnoordhuis commented 13 years ago

I suspect that you have the wrong idea about what node is. This is not a bug and it doesn't really belong in the issue tracker. Hop on IRC for some pointers, we're #node.js on freenode.net.

kfa1983 commented 13 years ago

Hmm I've just made an app that uses node, I think what I should know about node, I know xD If you want me to rephrase the question: why index.html loads and not index.php?

Thanks!

bnoordhuis commented 13 years ago

Because node and PHP have nothing to do with each other whatsoever. It's not apache + mod_php.

bmeck commented 13 years ago

I think we can figure this out but we need a bit more info:

Could you explain how you have Apache and Node running together (behind a proxy or whatnot)?

Are you trying to server PHP templates/files through Node? If so I would recommend an alternative template engine that Node has (Jade and EJS are popular).

What are you trying to do by switching the MIME type? Since Node and PHP have no relation to each other why would you put a PHP MIME on a Node served file?

But in answer to why it is being downloaded instead of viewed, that is how the browser interprets something of that MIME, any file served with that MIME is related to the browser's actions rather than Nodes.

kfa1983 commented 13 years ago

@bnoord, true but I thought maybe there was some kind of module to be able to inject PHP codes... Have you tried Node-Ugly or NodePHP? How do they behave?

@bmeck, thanks! Exactly, I have to load templates too... The project is a bottom chat bar using NodeJs, ExpressJS and Websocket. I've built the very primitive bar and some rooms to test the chat and it works super fine...

But all rooms are leading to the same convo (basically, that's the big problem)...

The convo is like: userA + userB + userC + userD + ... And it should be: userA + userB | userC + userD | + ...

Well, you know, private rooms. I thought I could do something using PHP but... What would you do?

isaacs commented 13 years ago

Not a node bug. Please take this to the mailing lists or IRC. Thanks.