Nov 22, 2009

Include Directives And Efficancey - Server preformance, response time

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Include Directives And Efficancey - Server preformance, response time

QBRADQ
Hello there.

Most of my programming experiance has been with compiled languages. However, I am now working in PHP.

In a compiled languages (or even a client-side scripting language), include directive only effect the preformance at compile-time. It has always been my style to make all global variables, functions, and data structures available to all source files by including a header file that would then in turn include all the project's headers in the correct sequence.

Now, as I have said, I am working in PHP. The design of my page is that of a program, with the <body> block treated as the main execution loop. Session data is used to carry volitile data from loop to loop. Global variables and definitions are used to hold static data, and a database is used to store data that should persist from sessoin to session.

Now, here's my consern: I am using include directive at the top of the main page to include all of my global variables and functions so that the page will have access to them all. But now I am beginning to wounder if that is such a good idea with a server-side script, from a preformance point of veiw.

My question: Does anyone know if PHP scripts are held in memory from execution to execution, or if all the files are read from disk with each invokation? If the latter is so, I could see a definite need to include variables and functions on-demand, rather than en-mass.

Any comments or suggestions would be welcome.
QBRADQ

 

 

 


Comment/Reply (w/o sign-up)

vizskywalker
Since the script is executed by the server at command and with certain input from the client (usually), I believe that all variables, files, etc. are read at run time, especially since they may change. But when MasterComputers gets on he will definitely have the answer.

~Viz

Comment/Reply (w/o sign-up)

Hercco
I understand there is some setting in php.ini which makies php to keep the included pages in memory and not reading it everytime from the disk. I don't know what the setting is, because I don't have own server and don't thus really get to tinker with them all that lot.

So yeah, better wait thill MasterComputers sees this thread biggrin.gif

Comment/Reply (w/o sign-up)

QBRADQ
Either way, I have restructure my scripts to include function definitions on a need-to-know basis. I've also put in provisions for the variable sets, but at this time all global variables are needed by nearly all pages, so I've kept them included at the top of the index page.

It's nice to know that there may be a way to improve the preformance of the all-inclusive design. But when it gets down to it that design ingnores one of the key features of module-oriented design, which is a principle aspect of scripted languages.

I supose it's a bad habit that I need to break myself of anyway.

QBRADQ

Comment/Reply (w/o sign-up)

Hercco
By the way, can't you compile ASP scripts? That'd be a nice option for PHP too, in case you have lot of includes.

Come to think about it, you could write a software that'd process PHP code so that includes would be replaced with the file contents. Could be one run on thr server after you have uploaded the files.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Directives Efficancey Server Preformance Response

  1. View Php In Another Server - (5)
  2. Mini Apache Server W/ Php - Grab it right now ... (5)
    Hi,     Those who don't want to go into all the hassle of configuring Apache with PHP -
    here's a quick alternative. Grab MiniApache_PHP from http://213.106.116.50/james/ . It's
    a much downscaled version of the real Apache server but includes the PHP modules too - very little
    headache over installation and you can start hosting your own sites rightaway. Good alternative for
    testing your custom php codes too... This is what the site says about the software: QUOTE
    MiniApache_PHP is a cut-down version of the open-source Apache web server software for W...
  3. How To Reset The Server Variable Php_auth_user - (9)
    Hi, i'm developing a web application which obviously requires a log in/log out script that i
    just implementing but i dont know why the log out script dont work fine. The problem is related
    with the server variable $_SERVER which remains set even when in the log out script i unset it with
    the unset() function. Does someone knows how can i reset or clear the server variable $_SERVER ???
    Best regards, ...
  4. User Authentication Session Handling Problems - Authorization server variables not staying across pages (14)
    This is quite a bit of problem I am facing, and I cannot point exactly where I am going wrong. I
    have been lurking around here at the Asta Host forums with regard to login and user authentication
    scripts and I have got as far as this: - Starting a session - Registering a session variable -
    Using the variable to check if the user is authenticated or not. - Authenticating the user through
    MySQL database - Logging of the user, by setting the session variable to un-authenticated I have
    been able to achive the following things too that I think is not related to this proble...
  5. Using Php With A Mail Server - (2)
    We all know you can use PHP with a web server, but can you use it with a mail server? I've made
    a personal messenger system, and I was thinking about adding additional functionality in the future,
    such as the ability to send mail from it. Then I started thinking, would it be possible to recieve
    mail with it? Say, have a PHP script that checked when a message arrived at the server, and when it
    does, check for something in the message (e.g. "pmsystem-to: admin") that would tell it to send it
    to a certain user, and then have it do the scripts to send a PM. So, is it...
  6. Saving A Php Generated Image To The Server - Help Needed Please (5)
    I'm trying to create a script that will generate an image and send it back to the browser while
    saving the same image to the server. I'm doing this because the image should be dynamically
    generated but because of the load that would place on a server if the image happened to be requested
    frequently, I've decided to build in a means to serve the static version of the image most of
    the time. What isn't included here is the function that will check the age of the file in cache
    directory and serve the static image if it is less than an hour old. This isn...
  7. Server-friendly Php Scripts - (5)
    Hi I'm relativly new to php... I'm interested in writing server-friendly php scripts and i
    was wandering in what cases php scripts are harmfull to server i runs on... i was thinking about
    issues like: * Which php functions are expensive from the point of view of server's
    performance and resources? * What is considered to be a long array in php context if ,say, each
    record is 100 bytes long? (100+ element ? a few thousands?) * Are there some assumptions that php
    programmer should avoid? (comes to mind this example: http://il.php.net/register_globals )...
  8. All in 1 server - PHP4,PHP5,ASP.Net (13)
    Hello, I'm hosting my own site web on my computer. I'm using IIS6 with ASP.NET and PHP4
    running on it and I would like to install also PHP5 to try it. Do you think it's possible ?...
  9. [PHP]fsockopen(): Timed_out - fsockopen() on a Irc Server (7)
    I have create a script that open a connection on a irc server like a BnC; when i test it on my local
    machine it's all ok, but here i receive every time Timed_out, and i don't know why, Someone
    can me explaine why? /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />...



Looking for include, directives, efficancey, server, preformance, response, time

See Also,

*SIMILAR VIDEOS*
Searching Video's for include, directives, efficancey, server, preformance, response, time
advertisement



Include Directives And Efficancey - Server preformance, response time

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com