Home » Php » high memory usage in php service on linux

high memory usage in php service on linux

Posted by: admin June 30, 2018 Leave a comment

Questions:

There is a 4gb memory usage per day and it does not clean at all

Have the following php script :

while(1){
    sleep(15);
    $data = // get data

    foreach ($data as $d){
        //get the db status
        // make api call in same ip to update server 
        // write log
    }
}

service linux code (via docker):

[program:cron]
command=/bin/bash -c "exec cron -f"
autostart=true
autorestart=true
startretries=3

What can be done to prevent that? it should be a sample service

Answers: