S
S
Sheti2016-01-08 16:58:28
linux
Sheti, 2016-01-08 16:58:28

How to start script execution from PHP?

The essence of the problem. There is a site that, with certain actions, should call scripts. For example. The text is placed on the site and an external script processes it. Because Since this processing can be long, it is unreasonable to perform it as part of the text upload to the site.
One of the options was to run scripts by cron. Another option is to write a demon and pull it, for example, by sending data through sockets. But here is another problem. Texts are not posted very often, and a constantly running demon would eat up RAM on a cheap VDS.
At the moment, I used the inetd daemon, which passes data received on a specific port to a C program, which in turn parses the command and runs the desired script. On the plus side, apart from the little inetd, most of the time no one has RAM.
Question. How well is the problem solved? And maybe there are easier ways to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Tsilyurik, 2016-01-08
@Sheti

At the moment, I used the inetd daemon, which passes data received on a specific port to a C program, which in turn parses the command and runs the desired script.

Normal solution (in the spirit of UNIX ;-)).
1. inetd - very outdated implementation, use xinetd;
2. why run a transit program in C, if you can run the script right away (extra steps)
May come in handy: inetd/xinetd superserver for your own purposes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question