Is it possible to use Apache Thrift on a regular web server?



I already have a web server that I pay for, and I want to expose some services on it using Thrift and PHP.

My question is: can I run a Thrift server using normal PHP that’s hosted on the default port (the same way web pages are hosted) instead of having a separate PHP application that runs on some funky obscure port. This way I wouldn’t have to change the server configuration (which is something I’m not able to do even if I wanted to).


EDIT: maybe I should clarify a bit more. Once I’ve defined my service using a .thrift file, is it possible to:

  1. Run the thrift code generator
  2. Take the generated code and put it on my webserver
  3. Create an index.php which says (in pseudocode) “create a new instance of the service, and handle incoming requests”?


Okay, well I have figured out the answer on my own!

If you use a TPhpStream on the server side, you are able to serve requests coming in as regular http requests.

Many thanks to Rob Wilkerson–PHP-.

I also blogged about how to implement a simple example with PHP and Python at

Answered By – Will Warren

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More