简体   繁体   中英

How do I run and external continually running C program with PHP?

I have code PHP code in my web app that runs an executable c program that I have. The c program constantly runs and outputs data to an output file.

I'm currently using this line to run the program

exec("/var/www/mcc-libhid/test-usb20X f &");

The problem is that since the program never ends, I get stuck on a loading page on my web app. I'd like my php code to start running this program and quickly return. Not wait for some end of it.

Is there an easy solution for this?

I found the solution to my question!

Here is the updated line that did what I wanted.

exec("/var/www/mcc-libhid/test-usb20X f >/dev/null &");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM