Hi,
I have a that page opens an imap connection; I need to refer to the
connection across various pages. I don't want to reopen that
connection on every page (vast waste of resources).
I have tried using sessions but they do not persist objects across
pages the php manual says that too.
I have searched all websites/forums and nobody seems to bring
up/encounter this type of problem.(refer it, if i missed)
I am used to asp where we could share a connection/object across pages
in the same website or even across websites on the same server.
I know the work around's:-
1) Reopen the connection on eve page --waste of resources
2) Save it to a database or file -- to much/complex maintenance work
for something simple.
Am I missing/not understood a feature in PHP4 or is it missing this?
Thanks
Ivan 2 2214
With total disregard for any kind of safety measures iv***********@f lashmail.com (Ivan) leapt forth and uttered: I know the work around's:- 1) Reopen the connection on eve page --waste of resources 2) Save it to a database or file -- to much/complex maintenance work for something simple.
Unfortunatly one of the major limitations of PHP is that you cannot
store resource types such as file handles or database connections.
You do have some access to persistant connections in the form of
mysql_pconnect (http://uk.php.net/mysql_pconnect), but it comes
with some disadvantages. Taken from the user notes:
Normally you do NOT want to use mysql_pconnect. This function is designed for environments which have a high overhead to connecting to the database. In a typical MySQL / Apache / PHP environment, Apache will create many child processes which lie in idle waiting for a web request to be assigned to them. Each of these child processes will open and hold its own MySQL connection. So if you have a MySQL server which has a limit of 50 connections, but Apache keeps more than 50 child processes running, each of these child processes can hold a connection to your MySQL server, even while they are idle (idle httpd child processes don't lend their MySQL connection to other httpd children, they hold their own). So even if you only have a few pages which actually connect to MySQL on a busy site, you can run out of connections, with all of them not actually being used.
--
Phil Roberts | Dork Pretending To Be Hard | http://www.flatnet.net/
Phil Roberts <ph*****@HOLYfl atnetSHIT.net> wrote in message news:<Xn******* *************** ***@216.196.97. 132>... With total disregard for any kind of safety measures iv***********@f lashmail.com (Ivan) leapt forth and uttered:
I know the work around's:- 1) Reopen the connection on eve page --waste of resources 2) Save it to a database or file -- to much/complex maintenance work for something simple.
-- One has to do the "not-so obvious" when the "obvious is not-so"
Unfortunatly one of the major limitations of PHP is that you cannot store resource types such as file handles or database connections.
Thanks, hope we see this feature in later versions You do have some access to persistant connections in the form of mysql_pconnect (http://uk.php.net/mysql_pconnect), but it comes with some disadvantages. Taken from the user notes:
Normally you do NOT want to use mysql_pconnect. This function is designed for environments which have a high overhead to connecting to the database. In a typical MySQL / Apache / PHP environment, Apache will create many child processes which lie in idle waiting for a web request to be assigned to them. Each of these child processes will open and hold its own MySQL connection. So if you have a MySQL server which has a limit of 50 connections, but Apache keeps more than 50 child processes running, each of these child processes can hold a connection to your MySQL server, even while they are idle (idle httpd child processes don't lend their MySQL connection to other httpd children, they hold their own). So even if you only have a few pages which actually connect to MySQL on a busy site, you can run out of connections, with all of them not actually being used. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Felix E. Klee |
last post by:
I've set up a PHP web application where users can log in and open a
connection to a NNTP-server. There is a *one-to-one* relationship
between sessions and NNTP-connections (i.e. exactly one NNTP-connection
per session, and exactly one session per NNTP-connection).
Now, I'd like to have these connections be persistent. So I started
using "pfsockopen" instead of "fsockopen" and set Apache's
KeepAliveTimeout to a very high value. ...
|
by: Paul Rubin |
last post by:
I've had this recurring half-baked desire for long enough that I
thought I'd post about it, even though I don't have any concrete
proposals and the whole idea is fraught with hazards.
Basically I wish there was a way to have persistent in-memory objects
in a Python app, maybe a multi-process one. So you could have a
persistent dictionary d, and if you say
d = Frob(foo=9, bar=23)
that creates a Frob instance and stores it in d. Then if...
|
by: brad |
last post by:
Hi,
Im using classic ASP (3.0) and I have a web farm with 2 webservers
(webserver A and webserver B, both windows server 2003). I do not want
to store any client specific information on the webserver (therefore do
not intend to use the session object- as you cannot gaurantee which
server the user will go to). I want to store a small value (e.g. a Y/N
value or an Id) on the client machine for the duration of their
browsing session, hence I...
|
by: Steve |
last post by:
Can anyone tell me the preferred method for writing and
retrieving persistent information using .Net.
Specifically, I am referring to information that you used
to see in registry keys or .ini files like the name of a
database or connection string.
I have read several articles indicating that .config files
are now used, but I am confused because they are read-
only. If I want to write information from within the
application (When a...
|
by: keegan.csmith |
last post by:
Hi,
I have started a new small web project, and was wondering if there are
any good guides on how to do Persistent Sessions and Authentication
using python and CGI. I don't really want too use Zope, because It's
probably overkill for my tiny project.
| |
by: howachen |
last post by:
Hi,
Are there something like a `Persistent global variable` in PHP?
It is something like `Application` in the classic ASP, all the request
share the same variable, and the die after a timeout.
|
by: Arnost Sobota |
last post by:
Dear ASP community,
I have a question regarding ASP session variables.
My assumption was that a session variable has the same lifetime as the
session itself: as a consequence, given that closing the browser doesn't
terminate the session, the session variable is kept alive until the
session expires.
But, surprisingly, I've found this to be true for the session variables
|
by: sanchita |
last post by:
Hello everyone,
I didn't get any response in "Security" forum hence posting here again.
I am having problem with persistent cookies. Even after setting
"CreatePersistentCookie" to true in "FormsAuthentication.SetAuthCookie" I'm
being logged out after the specifed timeout provided in "forms"
element of web.config.
I read somewhere that lifetime of persistent cookies depend on the timeout
|
by: cjhegarty |
last post by:
Hello,
I have an application which runs on a single linux box, with a C++ backend server and a web-based front end, with apache also running on the local server.
I'm using PHP to communicate with the C++ backend, and would like to just connect to the C++ server once, and have bilateral communication as follows:
1. As the user carries out actions on the web front end, just use fwrite to communicate with the backend on the persistent...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |