Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make php scripts run in parallel?

script1.php

<?php
session_start();
sleep(10);

script2.php

<?php
session_start();

I run script1.php in the browser and immediately after script2.php in another browser window. session_start() in script2.php can't execute until script1.php is not finished executing.

Why it happened and how to make php scripts run in parallel?

like image 705
fatemaker Avatar asked Aug 15 '26 12:08

fatemaker


1 Answers

Try

<?php
session_start();
session_write_close();
sleep(10);

Related: Thoughts on PHP sessions

like image 185
hakre Avatar answered Aug 17 '26 03:08

hakre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!