1

Since cloud instance is just a machine hosted remotely it should be able to behave like a local server. I have written some programs in C++ which I usually call in a PHP file through exec() function on my Windows 10 server.

For instance, I save the program to htdocs in the same folder and compile it and then PHP gets the data through frontend, does some logic and writes it to text file. Then it launches the C++ program like exec("main.exe"), C++ reads the data in that text file and does the final logic.

How can I do this on cloud service like AWS Elastic Beanstalk?

MLu
  • 23,798
  • 5
  • 54
  • 81

1 Answers1

0

You can for example bundle your compiled C++ program with all the required libraries together with your PHP code and deploy the same way you deploy the PHP code to Elastic Beanstalk. It can be in the same package or in a separate ZIP file.

BTW a comment regarding your architecture: If I were you I would run the C++ program as a background process exposing e.g. REST API over localhost to the PHP process. PHP would simply call the API with data, get the result back and continue. No need to start up a new process for every HTTP request, dealing with result files, etc.

Hope that helps :)

MLu
  • 23,798
  • 5
  • 54
  • 81