enable pcntl or something else!!

da_user99

New member
Joined
Sep 7, 2015
Messages
3
I have this php code:
PHP:
foreach ($jobs as $job) {
    $pid = pcntl_fork();
    if (! $pid) {
        $descriptorspec = array(
            0 => array("pipe", "r"),
            1 => array("pipe", "w"),
            2 => array("pipe", "w")
        );
        $process = proc_open($job['cmd'], $descriptorspec, $pipes);
        if (is_resource($process)) {
            echo $procout = stream_get_contents($pipes[1]);
            echo $procerror = stream_get_contents($pipes[2]);
            fclose($pipes[1]);
            fclose($pipes[2]);
            $return_value = proc_close($process);
        }
        break;
    }
}

please check it and add it in cron-job of directadmin, then an email you will receive that a function is disabled in your system, I think it is pcntl so I enabled it(I asked here but no one answered me how to do it, So I don't if I did it right or not)
but after enabling pcntl it is not woring yet.
note that before above codes, add location of some of your other scripts in $jobs array like this:

PHP:
<?php
$jobs = array(
'/home/your_directory/test1.php';
'/home/your_directory/test2.php'
);

please check it and tell me how can I use this codes in directadmin?
 
Hello,

I don't know where you try to use this code, but when I tried to fork a child process in a plugin for directadmin I found only one working solution (probably there were some other), and it was about using a C-program which would fork a child process for my needs.

If you want so we help you with your code, provide more details:

1. how do you run your code?
2. what error do you get?
3. how should it work?
 
Back
Top