OLS not responding when long execution time process

I've installed OLS for my php website.

When i run a script with long execution time, server stops responding to anybody except that long process. (not with high cpu)

How can i fix this ?

I'm sending emails with AWS, 3 seconds per email to 100 emails which makes it ~300 seconds execution time.

When i start executing the file, it does not respond to me until it finishes the process. i'm flushing buffers between every email sent, therefore i can see in browser if the process still running or stopped.

While i'm running this process, WebAdmin restart cant kill this process, (using ubuntu as OS) "sudo service lsws restart / stop" cant kill this process. it keeps running (sending emails) without stopping.

While this process is running, i cant access the site in any other tab or browser. And some seconds after starting the process, server stops responding to everybody.

What can be wrong? Which setting i should tweak ? Any possible explanation about this ?

I use htop to see how many resources are being used, but 8 core cpu's are seem idle (max 10%), memory is being used only 2-5%.