Re: scope of classes in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stuart Bailey wrote:
Hi
I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the customer). I have created an LDAP class, in a file class_ldap.php. It include methods for connecting to the server, binding a DN (effectively login), and adding posix groups.

I have an index.php with include_once 'class_ldap.php', which allows me to login using the HTTP authentication mechanism.

The connect method stores the resulting connection resource in a global variable (included in a config.php file). When I then go to add the posix group (from add_group.php, that also includes class_ldap.php), I find that the global connection variable is not valid.

My question is, do I need to connect and authenticate with the LDAP server every time I want to perform an action, or is there a way to establish a

you need to establish a connection at the start of every request php handles,
typically you perform one  [major] 'action' per request so the short answer is:

'yes'.

the connection to the LDAP server is a 'resource' type variable - php 'resources'
are only valid for the duration of the script.

connection for the user's session, that is cleared when the user logs out.

Many thanks,

Stuart.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux