 <p>Since your scheduled task is actually changing the permissions on the error log file, the only viable options I can see are:</p> <p>1) Make the scheduled task not write to the error_log. Add the following to the top of the cron job:</p> <p><code>error_reporting(E_NONE);</code></p> <p>2) Make the scheduled task write to the system log (event viewer in windows) by issuing the following command at the start of your scheduled task (PHP file):</p> <p><code>ini_set('error_log', 'syslog');</code></p> <p>3) If all of the above do not suit you, you can try scheduling the task as the IIS User/Group. This would insure that the permissions are met and error 500 is no longer caused. </p> <p>There is no magic fix to this, you can either change the scheduled task so it has the same UID/GID as the PHP process, or you can stop logging in the scheduled_task. </p>