RE: [PHP-DEV] PHP 4.0 Bug #5980: Informix ifx_connect reuses closed connection resource id From: Manuel Lemos (mlemos <email protected>)
Date: 08/12/00

Hello Andrej,

On 12-Aug-00 20:25:00, you wrote:

>> >And why is this a problem for you?
>>
>> I discovered this problem when I was creating a database and then
>creating
>> its tables in the same script. Creating a database has to be done
>by a DBA
>> user.

>Nope. All privileges info in Informix engines is stored in sys*
>tables. No database, not special users. Everyone who can access the
>engine can create database and become the owner.

I did not mean on Informix side. Metabase database installation manager
creates a database for you if want. Then it creates tables. Database
creation is done by a user that is defined in Metabase Setup options
for Informix that I specified by DBAUser. Tables are created by the Web
user, so the DBAUser grants RESOURCE privileges to the Web user when the
database is created.

This is meant to have "some" security in the sense that if some body hacks
your site grabbing the Web user password he won't be able to drop your
database.

Actually the DBAUser should only grant CONNECT privileges to prevent tables
to be dropped, but I need first to move database table creation and
dropping abstraction code to driver classes to be able to control things
better at that level. This is not yet possible but it will be before the
next public release.

>> The tables and other objects of the database can be created by any
>> user.

>Ooops, nope again. They can be create by DBA and RESOURCE privileged
>users. I think not everything can be done by RESOURCE.

Yes, I meant that you specify in Metabase Setup options which user should
be granted access to create the tables but it could be anyone including the
same specified as DBAUser .

>> When I used the same user for both things the connection was reused
>> but since I was closing and reopening it

>"it"? You are closing and reopening connection from PHP to Informix.

Yes, Metabase Informix driver checks if server, user or password are
different between two queries, the current connection is closed and a
new connection is established.

>> I encountered the problem.

>But you did not answer why is it a problem for you? I did not see this
>as a problem situation, so far?

Because Informix does not let you open more then one connection through
shared memory.

>> This problem is still a bug in PHP that needs to be fixed but I am
>avoiding
>> it by not closing the connection when the server, database, user and
>> password are the same. So this won't affect PHP Metabase driver
>unless you
>> use more than one Metabase database connection setups which is not
>usual
>> and it is not the way Metabase manager class works.

>Still confused...

What I mean here is that this is only a problem when you are using
different users to connect to the same Informix server in the same script,
which only happens when DBAUser is different from Web user when you are
creating up a new database using Metabase installation manager.

When you are already using Metabase in Web applications you only use one
connection that is established for the Web user so this is not a problem.

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: email protected>?subject=RE:%20[PHP-DEV]%20PHP%204.0%20Bug%20#5980:%20Informix%20ifx_connect%20reuses%20closed%20connection%20resource%20id&replyto=3364.259T1121T12863878mlemos <email protected>">mlemos <email protected>">http://phpclasses.UpperDesign.com/?user=mlemos <email protected>

--
E-mail: mlemos <email protected>
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>