Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts

    How to check if file writing is enabled and enable if not

    As the title says, I'm trying to figure out how to check if a server has file writing enabled, and how to activate it if its not. I read through phpinfo but was unable to gleam which option I was looking for, and when I google, I seem to only find details on how to write files.

    I'm not very good with server config, and my boss has no clue at all; any help would be appreciated.

    I got to this because he wanted me to put up a wordpress install, but the server couldn't write the config file, nor edit the .htaccess, meaning I had to install it locally to find how the files should have been setup.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,314
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Not being able to write to a file is a system permission issue. It's nothing PHP can solve. You'll either need to manually adjust the file via your CP or speak to your host about your default permissions.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    PHP can forbid file writing as well using combinations of things like safe mode and disable functions. Neither of these directives are enabled by default, and safe mode is gone in 5.4+.
    Typically as tango says this is a filesystem permission issue, not one of PHP. You should either check if is_writable is true on a file, or attempt to open it in write mode to see if it fails.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,535
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Yah, I found out the host defaults everything to 744... it makes sense, I just didn't realize it (the host I use defaults to 764), so it threw me off.

    Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •