Hi All, I looked at a list of running processes on my server, and some have been running for a while. The script in question should build/present a web page, and that's it. Should all my scripts end with an "exit(0);" if all is OK? Thanks!
exit function is only for breaking a script execution in the place where it should not break ( as an example, if loops with some verification ). No need to add it at the end of your script !
That's really not accurate at all. You shouldn't need to exit PHP unless you're sending a header(location) or intentionally trying to end the script before the last few lines of code. If your script is still running after a while, you've either got it locked up in a while loop, or something is going wrong because it should be exiting as soon as the last line of code gets read. Maybe you should run the code in a browser, or in a console and watch what's going on with it.
Using exit at the end of your script has no effect whatsoever. It only has an effect if you call it before it would otherwise end.
There is no need to put exit() function at the end of your pages/scripts. It is used in functions/classes/coding to exit the script normally used under if,else,while statments.
No exit() at the end is needed. However, placing exit() at the beginning of your scripts can significantly increase their performance
LOL, i tried it and my script didn't seem to run any faster and at times it just comes up blank ... wierd any help on that wmtips?... J.k
As projectshifter said, there really ain't no need of putting an exit() call at the end of your script, php will automatically exit your script if there ain't no problem in it (like infinite loop).
Thanks for all your help. I was using Bluehost and I once I activated their fastCGI option, the hanging stopped.