Cannot write file in php




















Learn more. Asked 6 years, 8 months ago. Active 1 year, 8 months ago. Viewed 22k times. Improve this question. David Foerster Moithil Biswas Moithil Biswas 1 1 gold badge 6 6 silver badges 14 14 bronze badges.

Does the user running the web server have write privileges on this file if existing or on the containing folder if creating a new file? That user also needs directory traversal privileges on all recursively containing directories. My question refers to that only i believe that - how do I set my apache2 to allow writing new files that php creates? It's not just a question of Apache configuration, but also of file system permissions, since you want Apache to write in the file system.

My problem is solved but still I am being prompted for getting low quality response for my question. See How do I ask a good question?

People are currently voting this as off topic, which I can only explain plausibly, because it may be appear to be about PHP programming and not Ubuntu web server administration on first sight. The downvotes may result from the lack of necessary, requested information in your question to track down the cause of the problem. If you want to know more, open a question on Meta. Add a comment. Use fclose to do that — deepakchethan. Add a comment. Active Oldest Votes.

Improve this answer. Exprator Exprator Please explain for OP and future users what you are doing here, instead of posting a code-only answer. Vivek D. Ben Ben 1 1 gold badge 11 11 silver badges 23 23 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Notice that we wrote to the file "newfile. After we finished writing, we closed the file using the fclose function.

Now that "newfile. In the example below we open our existing file "newfile. If we now open the "newfile. We just launched W3Schools videos. Get certified by completing a course today! If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.



0コメント

  • 1000 / 1000