Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to optimize my php code and I realize I am including the 'init.php' which contains the code connecting to database in every single php page. The further problem is that with every user click I essentially load another php script which mean I load the 'init' script with every single click.

is session relevant here? Maybe if I start a session and those scripts would not be included again? Or is using include_once solve the problem?

share|improve this question
If you are trying to optimize your code you really need to use a profiler, and not make wide speculations about what your problem might be. Random guessing will almost certainly waste your time and result in you optimizing things that aren't really the problem. – Zoredache Oct 23 '12 at 19:43

closed as off topic by Zoredache, Shane Madden, longneck, mdpc, mgorven Oct 23 '12 at 20:54

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.