Apache2, php and threads

This is a discussion on Apache2, php and threads within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello, i am plannung to develop a web application (actually an online game). I have learned that php may use ...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2004
Christian Neise
 
Posts: n/a
Default Apache2, php and threads

Hello,

i am plannung to develop a web application (actually an online game).
I have learned that php may use c++ classes from a shared library and
want to use this feature. I want to use apache2 and php 4.3.

So i think it is a good idea to make db accesses (to a mysql db) from
c++ to load objects from the db.

My question is: how to i handle the db connections? I think it is a
good idea to implement a static object inside the shared c++ library.
In its constructor the db connection is established. In its destructor
the db connection is shut down.

When the php script loads my shared c++ library the static object is
created, its constructor is called and the db connection is
established. When unloading the library the static object is
destroyed, its destructor is called and the db connection is shut
down. Is this a good idea?

I wonder how often my shared library will be loaded and unloaded. Will
it be loaded and unloaded for each execution of my php script? Or will
it be loaded once only and stays in memory for a certain time?

Is there one process for each php script execution? Is the process
shut down after the php script exits or does the process execute not
only one, but many php scripts? Is there a difference of using php's
dl command to load my shared library to compiling my shared library
into php as an extension?

How many threads will use the shared library? Has it to be thread
safe? Is it wise to establish a pool of db connection inside the
library?

Perhaps these questions are stupid. If there is an easy solution for
the problem of db access from a shared c++ library used in a php
script please let me know.

Thank you very much.

Best regards,

Christian Neise.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:14 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0