Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

php check if file locked with flock using -'php,filesystems,file-locking,flock'

php check if file locked with flock  using -'php,filesystems,file-locking,flock'

Will fopen() fail if a file exists, but is currently locked with LOCK_EX?

Or do I have to open it, and then try and set a lock, in order to determine if one already exists?

I've also read that flock() will;

  pause [the script] untill you get the lock for indefinite amount of time or till your script times out

If so, is it true this 'pause' can be by-passed with;

if (!flock($f, LOCK_SH | LOCK_NB)) {
    // file locked, do something else


asked Sep 8, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening