PHP Fopen issues while running script same script on server and command line
<p>I have one small script which open and append csv and put some information.
file name based on today's date.
But problem is coming when i run script from server it created under apache user and when same script run as cron run as different user. This creates issues and giving me errors</p>

<p>permission denial.   </p>

<p>my sample code</p>

<pre><code>$handler = fopen($file, 'a+');
fwrite($handler, date('Y-md H:i:s') . "\n");
fclose($handler);
</code></pre>
