How to integrate standalone application with PHP web interface

I’m working on a project where I need to connect my PHP website with a separate program that handles complex calculations. The main application is built using standard web technologies like PHP and MySQL running on Apache server.

The problem is that I have this really sophisticated processing engine that was developed as a standalone application using a compiled language like C++ or Java. This program needs to run independently in the background and handle heavy computational tasks.

What I’m trying to figure out is the best approach for establishing communication between my PHP web interface and this external application. I need to send input data from the web form to the background process and then retrieve the results back to display on the website.

Are there any recommended methods or patterns for this kind of setup? I’m looking for reliable ways to handle the data exchange between these two different environments.

ever thought about using message queues? i once used redis to connect a php site with a c++ app. just send the job through the queue and let the app handle it, then get the results back. way simpler than fiddling with sockets!

Database polling with status tables is perfect for this. I built something similar where my PHP frontend dumps job requests into a MySQL table with status fields, and the standalone app just watches that table for new work. When it finishes processing, it updates the status and dumps results back to the database. You get persistence for free, error handling is straightforward, and you don’t need any extra infrastructure beyond MySQL. Just make sure you index your status columns properly and throw in timestamp fields for timeouts. It’s not real-time, but polling every few seconds works great for most computational stuff and keeps everything reliable and simple.

how complex are your calculations? are we talking seconds or hours? also, what’s the data size you’re passing between them? that’ll help decide which approach works best. have you tried using php’s exec() function with command line execution? might be a simpler place to start.