title: Can't write log file in Linux using PHP
body: <p>I'm running CentOS 6.5 on a Google Compute Engine instance which I use for an ejabberd XMPP server. I also have php 5 installed and ejabberd is configured to use a <a href="https://www.ejabberd.im/extauth" rel="nofollow noreferrer">php script</a> to authenticate users.
  So far so good - ejabberd executes the script and recieves the correct result from it. The problem is: I want the PHP script to write a log file. So far I've tried:</p>
  <ul>
  <li>Writing a file using file_put_contents to /var/log/mlog.log - this didn't work. so I've tried manually creating the file and giving it chmod 777 (for testing). No result - the file remains empty. But - when I execute the script manually using php from terminal the log is written.</li>
  <li>Writing to syslog - I've configured php.ini to use syslog and then tried logging. Same result: nothing when ejabberd runs the script, but when I manually run it it works.</li>
  <li>Configuring error_log file and using error_log($message). Again, it didn't work.</li>
  </ul>
  <p>I came to realize it must be something wrong with the write permissions of the ejabberd user (which runs the php scripts), but even when I set chmod 777 to every file in every option of the above, the log remains empty.</p>
  <p>Any hints? What am I missing? (as you can probably tell, I don't have much knowledge in Linux and this is the first time I'm using it in a project)</p>