Skip to main content

PHP can't write files

Comments

8 comments

  • cPRex Jurassic Moderator
    Hey there! I don't think that is the correct solution. The better solution would be to ensure you're processing PHP as the user, and not as nobody. This can be done by adjusting the Apache handler (suphp, lsapi, CGI with suexec). You can find more details about the differences in PHP handler here:
    0
  • Ryan_G
    Thanks for getting back to me. One issue I have with changing to SuPHP is that the site is very complex and has been working successfully for years with PHP as nobody (it's a VPS with one site and me being the only user) so I don't want to change anything major as I'm worried it will break other things.
    0
  • cPRex Jurassic Moderator
    If that's the case, it will almost certainly break things, but it's better to break them when you're ready for it than when it is unexpected. I'd just plan to do that work during non-peak hours for the site, but you can always switch back to your current handler if you can't fix any issues that may come up.
    0
  • Ryan_G
    If it's likely to break things I don't think I can go down that road - the site monitors a large number of customers' websites and sends over 5000 HTTP requests every minute, 24/7 so there is no real off-peak. Ideally I just want to find (or make a best estimate) as to what has changed to prevent PHP generating the files and fix it.
    0
  • cPRex Jurassic Moderator
    Have you made any updates recently? What version of PHP are you using?
    0
  • Ryan_G
    I haven't made any updates recently - this actually happened months ago and it was a while before I noticed it. Since then I have just put a workaround in place manually generating the invoices but that's becoming inconvenient. The PHP version is 7.0 - I know this is outdated but this is a side project and I don't have much time to work on it.
    0
  • cPRex Jurassic Moderator
    It sounds like it might be time to overhaul the site in general. If all your permissions are 644 for files and 755 for directories, and everything is owned by user:user, I don't see why changing the handler *should* break anything. Any other workarounds are just that - workarounds - and could cause unexpected behavior in the future. I'm sorry I don't have a quicker fix available, but if the handler change does break things it's just a matter of running EasyApache again to put the old one back.
    0
  • Ryan_G
    OK thanks for the info - appreciate it.
    0

Please sign in to leave a comment.