TSG
TSG

Reputation: 4617

Best way to connect PHP script to executable on localhost

I am creating a C++ app which must provide information to a PHP script running on the same box. I'm wondering what is the best way to connect the app with the PHP script?

I could create a simple HTTP server in C++, or I could create a tcp socket and listen for a connection (not sure what php offers for access to localhost ports), create a local domain socket, etc..

ideas?


The C++ program is a service that is constantly running, so I'm not sure exec from php makes sense. Unless you are suggesting I write a second executable that communicates with the services, and sends back results through stdout?

Also sounds like a lot of overhead to use exec

Upvotes: 0

Views: 205

Answers (1)

user1918305
user1918305

Reputation: 2290

You could use the exec command.

Upvotes: 1

Related Questions