[PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Claudio Saavedra

Hi all!

I've stepped into an annoying problem when trying to fetch the tuples 
returned by a stored procedure in a MSSQL database from a PHP program 
running in a Centos Linux server running PHP 4.4.4.


The stored procedure returns an arbitrary number of tuples, and my code 
is only working when the SP returns one row.


The code I'm using, simplified, follows:

  $db_conn = mssql_connect (server, user, passwd);
  mssql_select_db(db,$db_conn);

  $query = Exec stored_procedure '$par1', '$par2';
  $result = mssql_query ($query);

  while ($row = mssql_fetch_array ($result)) {
  echo $row[COL1];
  echo br/;
  }

If stored_procedure () returns only one row, the code executes without 
any problem. However, if there are more than one rows to be returned, 
the program not only blocks, but also eats all the server's memory.


I've run this program also in Ubuntu with PHP 4.4, and it works without 
any problem, so I'm thinking it may be either a configuration problem of 
the centos server, or a bug in the PHP version.


Do you have any hint to solve this? I would appreciate any advice.

Thanks in advance,

Claudio

--
Claudio Saavedra [EMAIL PROTECTED]
-
La informacion contenida en esta transmision (y sus documentos 
adjuntos), es confidencial y no puede ser usada o difundida por 
personas distintas a su(s) destinatario(s). 
El uso no autorizado de la informacion contenida en 
esta transmision puede ser sancionado criminalmente de conformidad con 
la ley chilena. Si ha recibido esta transmision por error, por favor 
destruyala y notifique al remitente. Atendido que no existe 
certidumbre que el presente mensaje no sera modificado como resultado 
de su transmision por correo electronico, nuestra empresa, no sera 
responsable si el contenido del mismo ha sido modificado.


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



Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Frank M. Kromann
Hi Claudio,

1) Check the version of FreeTDS on both systems.
2) Check the freetds.conf file for differences (use the sam TDS version)
3) Check that php is compiled using --with-mssql on both systems
(--with-sybase will give you aliases to some mssql_( functions but not
all)

- Frank

 Hi all!
 
 I've stepped into an annoying problem when trying to fetch the tuples 
 returned by a stored procedure in a MSSQL database from a PHP program 
 running in a Centos Linux server running PHP 4.4.4.
 
 The stored procedure returns an arbitrary number of tuples, and my code

 is only working when the SP returns one row.
 
 The code I'm using, simplified, follows:
 
$db_conn = mssql_connect (server, user, passwd);
mssql_select_db(db,$db_conn);
 
$query = Exec stored_procedure '$par1', '$par2';
$result = mssql_query ($query);
 
while ($row = mssql_fetch_array ($result)) {
echo $row[COL1];
echo br/;
}
 
 If stored_procedure () returns only one row, the code executes without 
 any problem. However, if there are more than one rows to be returned, 
 the program not only blocks, but also eats all the server's memory.
 
 I've run this program also in Ubuntu with PHP 4.4, and it works without

 any problem, so I'm thinking it may be either a configuration problem of

 the centos server, or a bug in the PHP version.
 
 Do you have any hint to solve this? I would appreciate any advice.
 
 Thanks in advance,
 
 Claudio
 
 -- 
 Claudio Saavedra [EMAIL PROTECTED]
 -
 La informacion contenida en esta transmision (y sus documentos 
 adjuntos), es confidencial y no puede ser usada o difundida por 
 personas distintas a su(s) destinatario(s). 
 El uso no autorizado de la informacion contenida en 
 esta transmision puede ser sancionado criminalmente de conformidad con 
 la ley chilena. Si ha recibido esta transmision por error, por favor 
 destruyala y notifique al remitente. Atendido que no existe 
 certidumbre que el presente mensaje no sera modificado como resultado 
 de su transmision por correo electronico, nuestra empresa, no sera 
 responsable si el contenido del mismo ha sido modificado.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Claudio Saavedra
Hi Frank,

El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió:

 1) Check the version of FreeTDS on both systems.

It proved irrelevant. See above.

 2) Check the freetds.conf file for differences (use the sam TDS version)

No differences.

 3) Check that php is compiled using --with-mssql on both systems
 (--with-sybase will give you aliases to some mssql_( functions but not
 all)

I fixed it by compiling again php with --with-mssql instead of
--with-sybase. Now it works perfectly. Thanks for your suggestions.

Anyway, I wouldn't expect php to hang and kill my server if compiled
with --sybase. Maybe just a runtime error would be ok, but a hang like
that, it's a bug to me.

I would gladly report it, if I knew where should I. Do you think it may
be in freeTDS or PHP itself? I am not really into PHP internals.

Best regards,

Claudio

-- 
Claudio Saavedra [EMAIL PROTECTED]

-
La informacion contenida en esta transmision (y sus documentos 
adjuntos), es confidencial y no puede ser usada o difundida por 
personas distintas a su(s) destinatario(s). 
El uso no autorizado de la informacion contenida en 
esta transmision puede ser sancionado criminalmente de conformidad con 
la ley chilena. Si ha recibido esta transmision por error, por favor 
destruyala y notifique al remitente. Atendido que no existe 
certidumbre que el presente mensaje no sera modificado como resultado 
de su transmision por correo electronico, nuestra empresa, no sera 
responsable si el contenido del mismo ha sido modificado.

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



Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos

2007-01-12 Thread Frank M. Kromann
Hi Claudio,

bugs.php.net would be the place to report the bug. As both the MSSQL and
Sybase extensions are using the same FreeTDS library I would think the bug
is in the Sybase extension.

You will get more mssql_* functions with the MSSQL extension, and much
better support for storred procedures so I think you will be happy about
the change.

- Frank

 Hi Frank,
 
 El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió:
 
  1) Check the version of FreeTDS on both systems.
 
 It proved irrelevant. See above.
 
  2) Check the freetds.conf file for differences (use the sam TDS
version)
 
 No differences.
 
  3) Check that php is compiled using --with-mssql on both systems
  (--with-sybase will give you aliases to some mssql_( functions but
not
  all)
 
 I fixed it by compiling again php with --with-mssql instead of
 --with-sybase. Now it works perfectly. Thanks for your suggestions.
 
 Anyway, I wouldn't expect php to hang and kill my server if compiled
 with --sybase. Maybe just a runtime error would be ok, but a hang like
 that, it's a bug to me.
 
 I would gladly report it, if I knew where should I. Do you think it may
 be in freeTDS or PHP itself? I am not really into PHP internals.
 
 Best regards,
 
 Claudio
 
 -- 
 Claudio Saavedra [EMAIL PROTECTED]
 
 -
 La informacion contenida en esta transmision (y sus documentos 
 adjuntos), es confidencial y no puede ser usada o difundida por 
 personas distintas a su(s) destinatario(s). 
 El uso no autorizado de la informacion contenida en 
 esta transmision puede ser sancionado criminalmente de conformidad con 
 la ley chilena. Si ha recibido esta transmision por error, por favor 
 destruyala y notifique al remitente. Atendido que no existe 
 certidumbre que el presente mensaje no sera modificado como resultado 
 de su transmision por correo electronico, nuestra empresa, no sera 
 responsable si el contenido del mismo ha sido modificado.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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