You can not change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or by changing the time limit in the php.ini.
My Question:
So if we are trying to make/code something in PHP we should not be worried about “You can not change this setting with ini_set() when running in [safe mode]” as far as we are sure that the latest version of PHP is installed on the servers.
Going Further,
Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.
What does that means?
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit','1024M');
Does that mean that server companies have their wayround to superimpose restriction over what we are doing in the above code line?
PHP is not fully handling the HTTP request, a web server is (most used with shared hosting is Apache). Any HTTP request hits Apache first and if Apache decides after 30 seconds that that’s enough then it doesn’t matter what the timeout in your PHP is, the process will be stopped.
I believe/assume that in case of the dedicated hosting that limitation wont be there?
Additionally, in shared hosting larges sites are not (actually) hosted. The marketing gimmick is that everything is unlimited, but as storage/traffic/increases they show that no free lunch (= No unlimited Dude).
Unsurprisingly, most web hosts don’t want you to be able to tell your script to never time out and run forever, consuming their server’s CPU and RAM resources indefinitely to try and serve your webpage.
I sincerely doubt anyone is backing up Petabytes of data via a PHP script. Maybe an actual program that gets STARTED by a PHP script; but that said, anyone who is backing up terabytes/petabytes of data would own the server that they are using, and thus would have the ability to enable an infinite script because they own the server.
May be a gimmick, and may not be possible unless some is on dedicated hosting or has full access to the server. I am naive and may lack full understanding. I just shared in case we can brainstorm of any such possibility.
Nice analogy. You nailed it and put in simple words.
If you know of a shared hosting site that will 1) let you have a Petabyte of storage space, and 2) then make a backup copy of that entire Petabyte (so now you’re using up at least 1.4 PB) using a PHP script that 3) doesn’t mind you using their server’s resources for hours on end…
True, and shared hosting will actually never allow such a huge website on shared hosting. Unlimited is a trap. exceed a number and they will say get out of our hosting or move to dedicated cloud etc.
There is nothing like free lunch and unlimited is comparable to a free lunch.
Even if you exceed a certain amount of traffic email will come your website is abusing our servers and is dangerous to stability and scalability.