Portál AbcLinuxu, 30. října 2025 07:35
switch (pcntl_fork()) {
case 0:
$cmd = "/path/to/command";
$args = array("arg1", "arg2");
pcntl_exec($cmd, $args);
// the child will only reach this point on exec failure,
// because execution shifts to the pcntl_exec()ed command
exit(0);
default:
break;
}
// parent continues
echo "I am the parent";
Není to z mojí hlavy, našel jsem to jako komentář v popisu funkce pcntl_exec(). Takže jsem to ani nezkoušel a možná to nebude ani ono.
exec("skript_co_dlho_bezi > /dev/null &");
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.