473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Executed only once and used across all pages

I'm a bit new to PHP and there is something I'm not sure whether PHP
can grant.
Given my web application has some codes that only need to be executed
once(eg.configuration used over the whole site), but every php script
which needs that config seems to execute that once to get configuration
when a request comes.
Is there any mechanism that can make a script processed only once and
all other pages can use its output?
(Maybe this is impossible,but I just want to get a definite answer.)
Thx in advance!

Oct 16 '06 #1
3 1201

Da*********@gmail.com wrote:
I'm a bit new to PHP and there is something I'm not sure whether PHP
can grant.
Given my web application has some codes that only need to be executed
once(eg.configuration used over the whole site), but every php script
which needs that config seems to execute that once to get configuration
when a request comes.
Is there any mechanism that can make a script processed only once and
all other pages can use its output?
(Maybe this is impossible,but I just want to get a definite answer.)
Thx in advance!
it is normal practise to have one config file that is included in
whatever other scripts need it, thats the method i would recommend, if
the scripts were large and performance was on your mind, then you could
just write the outputs to a flat file and include that into your php
scripts, less work for php but more work for the coder.

Flamer.

Oct 16 '06 #2
Thx!
flamer di******@hotmail.com wrote:
Da*********@gmail.com wrote:
I'm a bit new to PHP and there is something I'm not sure whether PHP
can grant.
Given my web application has some codes that only need to be executed
once(eg.configuration used over the whole site), but every php script
which needs that config seems to execute that once to get configuration
when a request comes.
Is there any mechanism that can make a script processed only once and
all other pages can use its output?
(Maybe this is impossible,but I just want to get a definite answer.)
Thx in advance!

it is normal practise to have one config file that is included in
whatever other scripts need it, thats the method i would recommend, if
the scripts were large and performance was on your mind, then you could
just write the outputs to a flat file and include that into your php
scripts, less work for php but more work for the coder.

Flamer.
Oct 16 '06 #3
You can find a better solution in this article:
http://www.nurazije.co.nr/2006/10/us...ns-in-php.html
It is exactly what you need, upload your output once and use it all the
time easly..
Regards,
Ashraf Gheith

Oct 16 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave Smithz | last post by:
Hi there, Working on the PHP DB I took over I have just come across a problem. When the user presses refresh in some circumstances the command they just performed will be re-performed. In some...
6
by: Christian | last post by:
HI, I have a function that is used to constrain a query: Select COl1, Col2 From MyTable WHERE col1 = ... AND col2 = ... And MyFunction(col1) = ... My problem is that MyFunction is executed...
9
by: cmac | last post by:
Greetings, I love the HV menu and have been uning it for a long time. I recently was asked how to make a page for my wife (wedding coming up soon) and my wife would like to have 2 ways to...
1
by: Ani | last post by:
Hi, I need to carry the user input across pages and then at the end insert all the values into the DB. How do I best accomplish this task in ASP.Net. I am a novice , please give me some simple...
2
by: Simon-Pierre Jarry | last post by:
Hi, I created a custom HttpModule for managing the security of my application. in "Init" sub, I regsiter the events doing that : Public Sub Init(ByVal context As System.Web.HttpApplication)...
5
by: Clodoaldo Pinto Neto | last post by:
I suspect there is something wrong because it takes 73s to delete a single line from a table whith 140 lines. So I tried to reindex the database: bash-2.05b$ postgres -P -O -D /var/lib/pgsql/data...
5
by: GaryDean | last post by:
I have a 1.1 asp.net project that has been converted by the conversion wizard. By and large the app runs allright except for one page... On one of the .aspx pages, the code behind file is not...
2
by: Chris | last post by:
In SQL 2005 I have a stored procedure as below: @sub_no smallint OUTPUT BEGIN BEGIN TRANSACTION INSERT...INTO
3
by: Ed Sonneveld | last post by:
Hi, I have hosted my webservice at a hosting company and it has been working fine for 2 years now. The webservice is called by winforms clients over the internet, using the proxy class generated...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.