D
D
dentxt2019-01-13 14:52:55
PHP
dentxt, 2019-01-13 14:52:55

Hosting Node.js and PHP applications on the same server?

There is a website in PHP, an application in Node JS and a VPS server.
The essence of the idea is as follows:
-> The user sends a file through the site
-> NodeJS application processes it, receiving the necessary information in string form
-> This data is stored in the database

Now the question. How can I host and link two applications on the same VPS, and most importantly, transfer the file from the site to the NodeJS application and then save the received data back to MySQL.

I understand that the question is quite superficial, but I do not know how else to describe the situation.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rPman, 2019-01-13
@dentxt

The vast majority of backend file uploaders store it as a file on the server, i.e. it is enough for you to pass the name of this file to nodejs. Do this through your database and take the result through it.
web client -> web server in php -> file on server -> nodejs -> database (from here php server will give it to clients)

L
Leo Developer, 2019-01-13
@crazy_leo

As far as I understand, you don't do database operations in PHP.
And the problem is how to give the NodeJS file intermediately.
Therefore, when the user sent a file to the site, the site makes a request to NodeJS and when NodeJS answered it, then the site (in PHP) does something there (writes it into the database)
And of course, don't forget to turn on 2 servers (for php, and nodejs ) on different ports (8080 for php, 3000 for nodejs for example).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question