You don't need to change any coding of any of your files in the /counter
directory, if things continue to work with the output_buffering
for that folder.
You generally don't need the output_buffering
option turned on, and it's off
on the server by default. But it is necessary for some scripts in order to function properly.
It looks like you had a /public_html/php.ini
file, and also already had set your php.ini file recursive
In that /public_html/php.ini
file you had the entry output_buffering = On
, and because it was recursive because of the .htaccess
rules, it was also carrying down to your /counter
folder causing the issues you first reported.
Placing another php.ini
file inside of the /counter
folder overrides the one from the /public_html
directory, fixing the problem in this case.
Typically you don't want to set the output_buffering
setting to On
, but rather a limited value such as 4096
, this is mentioned in the PHP.net output_buffering documentation
You might also want to be careful about loading large files through PHP instead of providing a direct link to a large file instead. You can monitor your CPU usage
to make sure your PHP scripts aren't causing any issues with this.