Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7795831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:11:00+00:00 2026-06-01T23:11:00+00:00

unlink(cache/data.xml); I feel that this may generate an error at times when sever might

  • 0
unlink("cache/data.xml");

I feel that this may generate an error at times when sever might be reading and serving it to the visitor.

how to safely delete the file so script will continue to wait until the read lock from the web server is released if any and then continue deleting the file or how it works out there?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:11:02+00:00Added an answer on June 1, 2026 at 11:11 pm

    This will depend on the specific system this is running on, but the man page for the UNIX unlink function (which the PHP unlink function very likely relies on internally) says this:

    The unlink() function removes the link named by path from its
    directory and decrements the link count of the file which was
    referenced by the link. If that decrement reduces the link count of
    the file to zero, and no process has the file open, then all
    resources associated with the file are reclaimed. If one or more
    process have the file open when the last link is removed, the link is
    removed, but the removal of the file is delayed until all references
    to it have been closed.

    In other words, the process reading the file can continue to do so, even while the file is being deleted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using UNLINK with PHP and AJAX . I know that in this way
When running git gc, I keep seeing this error: rm: cannot unlink 'pack-30b1ff2[reset of
Please note this is not duplicate of File r/w locking and unlink . (The
Are unlink , fsync , and rename the only ones that are by definition
When I call unlink like so: unlink($_FILES['upload_file']['tmp_name']); I get the following error message: unlink():
I have strong reason to believe that both functions rename() and unlink() are asynchronous,
This question is related to a Windows install of PHP5. Doing a file unlink()
I was reading over the Dropbox API and I found this line: NSString* title
R provides two functions to remove files (and folder) from the file system: unlink
I need to delete a folder with contents using PHP. rmdir() and unlink() delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.