2

I have a basic install of Apache2 server and PHP5.3 on my local Ubuntu machine.

I created file index.php and put sleep 30 seconds in it

<?php
sleep(30); // script sleep 30s
?>

When i run "localhost/index.php" in web browser, request are waiting that 30 seconds.

During that time I delete that line sleep(30); and run in new tab "localhost/index.php"

Second request is waiting first to finish, so wait that 30s.

That is a problem because Apache run only one process/thread. How to configure Apache to run normally? Or can someone explain to me what's going on?

2 Answers2

2

You probably have a deadlock on the session file; turn off session.auto_start, and/or call session_write_close() before sleep(30).

TML
  • 358
1

It's related to PHP's session. The session file (that bizarre file that is on /tmp/SOMETHING) gets locked for the first request.

You should call session_write_close() before the sleep() (or any time-wasting call). You might disable session_autostart if you don't want to use it either.

slm
  • 8,010
Vitor
  • 11