PHP file_put_contents not writing to local file


I just want to know if I'm doing something obviously dumb or I'm missing something. I have a very simple script set up to collect email addresses from a form, and initially I had the script writing to a local file. However, no output appears in the file.

File permissions appear fine, the output file is outside the doc root directory, and the script otherwise runs fine. What could be wrong?



3 Replies

"I had the script writing to a local file"

Do you mean the script was working while you developed it and now that it is invoked from the web server it doesn't work, or do you mean that it was working from the web server and now it's suddenly stopped?



It was working on my local machine under my MAMP server (which I use for development), but not when I transferred it to my linode instance.


Check your web server error logs, php errors often get dumped there, also check your php.ini settings is open_basedir restricting access?


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct