WordPress.org

Ready to get started?Download WordPress

Forums

access denied for custom php script using fwrite (3 posts)

  1. teamplaylotto
    Member
    Posted 7 years ago #

    I have written a script in php that adds data to a text file so I can parse it in the wordpress index page but every time the script runs and tries to fwrite a new bit of text to the file I get a "failed to open stream: Permission denied in " message.

    is this to do with my htaccess file?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    No, it's more likely to do with the permissions on the text file. Give it 644 permissions. If that fails, give it 664 permissions. If that fails, give it 666 permissions. If even that fails, talk to your host and ask them what permissions it should have to be writable by the webserver process.

    Use the smallest permissions number that actually works.

  3. teamplaylotto
    Member
    Posted 7 years ago #

    fantastic!
    i got to 666 and it worked. I always thought that 755 would be bestest.

    thanks for your help, all is working now and the site is much faster now I don't have to parse a remote file.

    Andy

Topic Closed

This topic has been closed to new replies.

About this Topic