Ok, here is my theory about the investigations i have made:
First a little info: apache has a variable called TimeOut
http://hoohoo.ncsa.uiuc.edu/docs/setup/httpd/TimeOut.html, this works like this: if the server receives no data from the script after that Timeout period it will stop the connection and give the timeout
Now why the simple scripts work: they work because the data we output are directly sent to the server(the echo, print, print_r functions)
Why doesn't it work when we run the same process through Joomla:
- when running any function through the Joomla (index2.php?option=component&task=some_task for example) the output of the process run is not sent directly to the server, it's caugh by a function called ob_get_content, here is the manual that starts this process (ob_start() function)
http://ro2.php.net/ob_start
Now, even if the process is running, the data outputed from it won't go directly to the server, it's stored in a Joomla variable, and only when all is done in our function the Joomla core comes in and displays the data in the template
So, the process runs, but no data is sent to the server beucase it's output is caught with ob_start() function!
The SOLUTION: ask you provider or you, if you have access to the apache config(httpd.conf) to increase that TimeOut variable!
This is the only explications i have found for the Timeout in cases when max_execution_time limit is set to a value that doesn't count, and can be documented by the file administrator/index2.php where you will find the ob_start() function!
Hope it helps! Regards, Ovidiu