reactphp / reactphp

Event-driven, non-blocking I/O with PHP.

Home Page:https://reactphp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect reactphp App to cPanel

Nedum84 opened this issue · comments

I have developed a restful API using reactphp but i don't know how to configure it to work with cpanel. I need a guide on this.

Not sure if cpanel supports running your own services with it. Would suggest reaching out to them and your hoster on how to do this.

A2hosting said they would have to open up a port for me but I would also need a static IP address (not free). That was to use socket.io but I think it would be the same for a ReactPHP server.

I later fixed it by purchasing a VPS and configuring the server on a port.

@Nedum84 This is an interesting one!

The way @reactphp is most commonly used is by running it as a long running process like an application server, so this would usually require some kind of command line access to configure and launch this process.

That said, it's also completely possible to use ReactPHP in a traditional short-lived PHP application that only handles a request and then terminates. In this case, you're bound to your HTTP request lifecycle and wouldn't want to start any long running server sockets or timers that would run longer than the HTTP request round trip as everything should terminate once the HTTP response is sent.

You may also want to check out https://framework-x.clue.engineering/docs/best-practices/deployment/ which describes how this can be used in a web application that can run both from a traditional web application and in a long running application with the exact same code base.

I hope this helps 👍