I have a C program that takes in input parameters and uses them to compute the trajectory of a particle. I want for this program to be hosted on my AWS EC2 server running linux, so that when someone loads a webpage loaded on the server they are able to input the parameters, run the C program on the server, and then see the results (images, plot with gnu plot etc..). I'm thinking of running a LAMP server but am unsure whether FLASK would be easier. Any help is appreciated. Running Apache.
You should look up what the CGI interface does. CGI means Common Gateway Interface here.
On your webserver, you could put your C program into a directory that has special permissions for the web server process. For instance, the directory must be enterable by the web server, and your C program must have execute permission for the "Others" group. Wrap your C program with a shell script if necessary.
CGI specifies how your webserver takes input data from the web user. Your webserver then calls your C program as a console script, collects the output from the C binary, and then sends that output back to the user.
CGI was used a lot in the 1990s, but it does not scale up to 100s of users, has difficulty with long-running processes and has security problems. Therefore it has fallen out of fashion in the 2000s.
But for, say, an inhouse application with a small set of users, CGI programs can still be used, and IMHO programming CGI scripts is a useful skill to have.
To be honest, I think these day's it's just a matter of choice, with web assembly being the more modern. The deciding point is that if the code should run on the server, use CGI, if in the browser, use web assembly.
You can do this using Web assembly.