Pritaeas is right. If you're in a shared hosting environment, you can change the timeout that way, however, you will never get the script to run forever in a shared hosting environment.
Shared hosting setups are done in a way that forbids your script from running for a defined period of time (usually between 60 to 300 seconds), you will not be able to control that or get around it without using a dedicated or virtual dedicated server. They do this to stop a user from writing inefficient code, keep user from taking all system resources, and to ensure that a customer does not hinder the service level requirements for other customers.
If using set_time_limit() does not fix the issue, and you're in a shared hosting environment, then there's little to nothing the you'll be able to do without streamlining your code.
now, i set set_time_limit(500)...and now i am not facing this error. its working. Can you tell me clearly whats the advantage and disadvantage in using "set_time_limit(500)", please. Did my server gets slowed? This page will be used by nearly 50 persons a day....did my server gets affected. Please tell me
Well, the bigger question is what is trying to be done on line 172 of your code? It may be inefficient code and by making it more efficient you don't need to worry about the ramifications of using such a high execution time.
Aside for the possibility that it will slow your overall computer down, or that more RAM will be used because 20+ users will be running the same process that's on line 172 of your code or other issue.
Therefore, what exactly is being done on line 172? Maybe we can help you optimize your code so you don't have to change PHP-wide settings for one function's slow process.
Is he trying to download excel files from clients? If so, is there a way to exclude the time to download the file from php code running time?
Create a symbolic link to the actual file and make the download link point at the symbolic link. Then, when the user clicks on the DL link, they'll get a file download from the real file but named from the symbolic link. It takes milliseconds to create the symbolic link and is better than trying to copy the file to a new name and download from there.