How to create file locker php software?

Asked By 40 points N/A Posted on -

Hi everyone,

How to create file locker PHP software?

I want to create software that will enable to encrypt and lock a specific file folder or data automatically using PHP programming language.

Is it possible?

Can you rate the percentage of possibility?

And also explain why.


Answered By 0 points N/A #187160

How to create file locker php software?



You can use this code below to automatically check a file to see if it has been locked and if it has not the script when ran will lock onto the specified file.

If the file cannot be locked onto the script also allows you to receive an error message telling you that the file is locked by another process and terminate.


    $fp = fopen("fileyouaretryingtolock.txt", "w");
    if (flock($fp, LOCK_EX | LOCK_NB)) {
        echo "Lock is achieved!n";
        flock($fp, LOCK_UN);
    } else {
        print "File is locked by another process!n";


Login/Register to Answer

Related Questions