php - session_start hangs -
since few hours our server hangs every time session_start.
for testing purposes created script looks this:
<?php session_start(); ?>
calling console hangs , can't stopped ctrl-c, kill -9 works. same calling via apache. /var/lib/php/session/
stays empty permissions absolutely fine, www can write , has read permissions parent folders.
according admins there no changes made on server , there no special code registered sessions. server centos 4 or 5 , yesterday working perfectly. rebooted server , updated php, nothing changed.
i've ran out of ideas, suggestions?
update
we solved problem moving project server, while problem still exists on 1 server there no immediate need solution anymore. keep question open in case has idea others having similar problem in future, though.
there many reasons that, here few of them:
a. session file opened exclusively. when file lock not released whatever reason, causing session_start()
hang infinitely on future script executions. workaround: use session_set_save_handler()
, make sure write function uses fopen($file, 'w') instead of fopen($file, 'x')
b. never use following in php.ini file (entropie file "/dev/random
"), cause session_start()
hang:
<?php ini_set("session.entropy_file", "/dev/random"); ini_set("session.entropy_length", "512"); ?>
c. session_start()
needs directory write to.
you can apache plus php running in normal user account. apache of course have listen other port 80 (for instance, 8080).
be sure following things: - create temporary directory prefix/tmp
- put php.ini
in prefix/lib
- edit php.ini
, set session.save_path directory created
otherwise, scripts seem 'hang' on session_start()
.
Comments
Post a Comment