Check this code:
<?php
$url = 'http://www.example.com/downloads/count.txt';
$hit_count = @file_get_contents($url);
$hit_count++;
@file_put_contents($url, $hit_count);
header('Location: wmwc.zip');
?>
@file_get_contents
is working fine and the header location change to the downloaded file also works, but either the hit_count increase or @file_put_contents
isn't working, because the number with the file doesnt increase by 1. I've set the file permission to 777, but when I try to set the directory permission to 777 also I get a 500 internal server error saying "The server encountered an unexpected condition which prevented it from fulfilling the request."
You can't write a remote file via http.(If you could do that, every one else could change that file also.)
You need to use the local path.