Can I run a program on a Linux server through a web page?

can I run a command-line-based application on the Linux server through the browser and return the results to the browser?

specifically, for example, there is an executable program on the server, and the input and output are images. Call it in shell as follows:

. / ImgProcApp input.jpg output.jpg

where input.jpg is the input of the user, selected by the user in the browser, and output.jpg is the output of the program ImgProcApp, which is displayed in the browser after the program has been executed.

ImgProcApp is a normal binary program that can be run in shell. It is written by CPP and needs to be run on the server.

what technology is used to implement it (on the Linux server)?


if it's Java, Runtime.getRuntime (). Exec () know about
if it's Python, os.popen and os.system know

according to the business scenario, input.jpg is uploaded for users, so if your ImgProcApp only supports file input, you need to store the uploaded file to the specified directory and pass the path.

Similarly, the output is stored as a file and then read through java or python (or exported to a directory where the browser loads as static resources) and returned to the client.


if it is php, then use the exec method


first to create a tomcat, and then to develop the simplest website to put it on, and then fight against the permissions


several key technologies commonly used to solve problems have been mentioned above. The front end takes the data to the back-end interface layer, and the back-end interface simply processes it, then calls your underlying program ImgProcApp for processing, and then the interface obtains the underlying processing results, does some processing, and returns the results to the front end to show the corresponding results.

Why did BTW,sf tweet this question to me as a Weekly selection ? The discussion here is not very heated. No, no, no.

@ SegmentFault


that's what Tencent Cloud web link servers do


in reality, it's possible but dangerous. If you execute a delete command, cry


cgi. As long as it's executable, you can

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e3e061-597ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e3e061-597ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?