Hi,
I have developed a recursive FTP-download script, in PHP5, that allows you to select some files and/or directories to download using an AJAX request. The POST-variable that the server receives is just a short pipe-separated string that does not take up any memory at all.
The script itself works perfectly on my local Apache setup and goes into each directory and downloads every single file and folder.
On my remote virtual server which is set up under Media Temple the script fails on large structures, that is handled great by my local Apache.
The symptoms is that some directories are considered to be files and therefore the script won't step into them and download further.
The script checks whether or not a path is a directory by trying to open it remotely. If it can open the directory it recursively downloads everything in it until it finishes.
The php.ini that is hosted on Media Temple has a much higher threshold than the one on my local setup (longer max execution time, higher memory limit etc.) so that's not the issue... I have even tried using my local php.ini on the remote server.
Tailing the error log used to get my "Premature end of script headers, PHP" until I switched to a dedicated virtual server from regular hosting. Now it doesn't react at all.
What I've tried to solve the issue is experimenting with different values in php.ini and most recently I did a flush() and ob_flush() for every new file and directory that was created... in an attempt to stop any occurance of "Premature end of script headers, PHP".
Do you have any ideas?