A
A
Alex Smith2017-03-28 18:21:46
linux
Alex Smith, 2017-03-28 18:21:46

The running php script from the console eats up a lot of memory, why?

Script Code

<?php
sleep(10);
die();
?>

It just starts up and sleeps.
I run this script 100 times with another script via command line
for($i=0;$i<100;$i++){
    system("php7 ../../web/console.php > /dev/null &");
}

And this code eats up about 700 MB of RAM
Why does such a simple script "eat up" so much memory?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex stephen, 2017-03-28
@berezuev

RAM eats not sleep, but running processes of PHP interpreters in the amount of 100 pieces.
To confirm my words, you can open htop, and in the next window execute: (launch php interactive mode in the background 100 times)
for i in {1..100}; do php -a & done;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question