[PHP-DB] PHP / iODBC / PostGreSQL: running into a deadlock

2010-05-24 Thread prometheus
Hi,

I recently decided to setup my mac for some php developments.

OS X 10.5 already ships with Apache, PHP and I chose PostGreSQL as DB
server. I picked a package link from the official website and I installed
it. The DB server is running smoothly.

Now, as OS X's php module is not pgsql-enabled, I chose to take advantage of
libiodbc (which php can handle). I installed psqlODBC driver.
- testing with `iodbctest': the program finds libiodbc which in turns uses
psqlODBC driver to connect to the database; I can issue SQL statements which
succeed = OK
- connecting php to libiodbc (note that I get the same results whether I
use php module with Apache or the CLI): odbc_connect() works correctly, the
DSN is found and I get a connection on PostgreSQL server. The problem arises
when I try to use odbc_prepare(), odbc_exec(), etc. functions. I run into
some kind of a deadlock which causes those functions to never end. I
couldn't find any solution/description of this problem for Mac platform in
Google.

To try to solve this issue, I grabed the sources for PHP (5.3.2) and
libiodbc (3.52.7). When ran under GDB, I can observe the following:
odbc_exec() [PHP code] calls SQLAllocStmt() [libiodbc code], which calls
some internal function that tries to call SQLAllocStmt(), in some indirect
recursive way. As SQLAllocStmt() is protected by a mutex, there's a
deadlock.
The BT is as follows:
#0 0x90529d85 in pthread_mutex_lock ()
#1 0x00bd6cec in SQLAllocStmt (hdbc=0x1016200, phstmt=0x1828034) at
hstmt.c:427
#2 0x00bd667a in SQLAllocStmt_Internal (hdbc=0x1827940, phstmt=0xdc5cec) at
hstmt.c:241
#3 0x00bd6db6 in SQLAllocStmt (hdbc=0x1827940, phstmt=0xdc5cec) at
hstmt.c:430
#4 0x00238808 in zif_odbc_exec (ht=2, return_value=0xdc454c,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0) at
/usr/local/php/src/5.3.2/ext/odbc/php_odbc.c:1551
#5 0x004d020d in zend_do_fcall_common_helper_SPEC (execute_data=0xf28040) at
zend_vm_execute.h:313
#6 0x004d5815 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0xf28040) at
zend_vm_execute.h:1603
#7 0x004cf346 in execute (op_array=0xdc5d38) at zend_vm_execute.h:104
#8 0x0049fec9 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
/usr/local/php/src/5.3.2/Zend/zend.c:1194
#9 0x004231f5 in php_execute_script (primary_file=0xb98c) at
/usr/local/php/src/5.3.2/main/main.c:2260
#10 0x00578f7b in main (argc=2, argv=0xba84) at
/usr/local/php/src/5.3.2/sapi/cli/php_cli.c:1192

Regarding why this doesn't occur with `iodbctest', the answer is that is
simply doesn't call SQLAllocStmt(). It replaces this call with
SQLAllocHandle().

Now, I'm wondering:
- am I the only nut to try such setup on OS X (Apache, PHP, ODBC,
Postgres)?
- is that some configuration issue?
- is that a problem either in PHP or libiodbc code?

Thanks!

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



Re: [PHP-DB] PHP / iODBC / PostGreSQL: running into a deadlock

2010-05-24 Thread Chris



To try to solve this issue, I grabed the sources for PHP (5.3.2) and
libiodbc (3.52.7). When ran under GDB, I can observe the following:
odbc_exec() [PHP code] calls SQLAllocStmt() [libiodbc code], which calls
some internal function that tries to call SQLAllocStmt(), in some indirect
recursive way. As SQLAllocStmt() is protected by a mutex, there's a
deadlock.
The BT is as follows:


Probably best to ask on the php-internals list, they write the C code 
behind php so will be best able to help you.


--
Postgresql  php tutorials
http://www.designmagick.com/


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



[PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Van Ingen, Lane
I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux 
10.0.0 . I am getting
the following error out of Apache:
Fatal Error: Call to undefined function: pg_connect()
 
After browsing your web site, I found http://us2.php.net/pgsql . But am unable 
to proceed because I
am not sure what to do. Specific questions:
  (1) How do I determine what version of PHP I have? Browsed PHP directories, 
but couldn't find it.
  (2) The information I found said I could use a shared object module and/or 
(I think) alter php.ini .
 
I don't think this is hard to fix, but I need to find a blow-by-blow of what to 
do. Can somebody help me?


Re: [PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Stephen Johnson
Did you compile php or did you install from a binary?

If you compiled -- did you configure the PHP module --with-pgsql?

I have not installed a binary in the past so I am not sure how you activate
the pgsql module in that regard.

The problem though is that the version of PHP you are running is not
configured to support pgsql and you will need to do that to get it recognize
the pgsql specific functions.


?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

 From: Van Ingen, Lane [EMAIL PROTECTED]
 Date: Thu, 10 Mar 2005 14:32:39 -0500
 To: php-db@lists.php.net
 Subject: [PHP-DB] PHP and PostgreSQL
 
 I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux
 10.0.0 . I am getting
 the following error out of Apache:
   Fatal Error: Call to undefined function: pg_connect()
 
 After browsing your web site, I found http://us2.php.net/pgsql . But am unable
 to proceed because I
 am not sure what to do. Specific questions:
 (1) How do I determine what version of PHP I have? Browsed PHP directories,
 but couldn't find it.
 (2) The information I found said I could use a shared object module and/or
 (I think) alter php.ini .
 
 I don't think this is hard to fix, but I need to find a blow-by-blow of what
 to do. Can somebody help me?
 

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



RE: [PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Mychael Scribner
save this to a php file and run it. I a attached file just in case.

?php
phpinfo();
?

This will give you all of the information you will need for you php 
installation.

-Original Message-
From: Van Ingen, Lane [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 10, 2005 2:33 PM
To: php-db@lists.php.net
Subject: [PHP-DB] PHP and PostgreSQL


I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux 
10.0.0 . I am getting
the following error out of Apache:
Fatal Error: Call to undefined function: pg_connect()
 
After browsing your web site, I found http://us2.php.net/pgsql . But am unable 
to proceed because I
am not sure what to do. Specific questions:
  (1) How do I determine what version of PHP I have? Browsed PHP directories, 
but couldn't find it.
  (2) The information I found said I could use a shared object module and/or 
(I think) alter php.ini .
 
I don't think this is hard to fix, but I need to find a blow-by-blow of what to 
do. Can somebody help me?

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

RE: [PHP-DB] PHP and PostgreSQL

2005-03-10 Thread Van Ingen, Lane
I think from binary; it was installed as a part of Slackware, and I made no 
special efforts to compile. 
   Version of PHP is   4.3.7  (thanks Mychael)
 Other:
   Linux kernel is 2.4.26
   Apache version is 1.3.31
 
Looks like MySQL may already be configured in PHP (saw that in phpinfo() )
 
When installing PostgreSQL, I am fairly certain I made no attempt to configure 
anything in the database
to permit use of PHP, as that was not a consideration at that time. In fact, 
not sure it even asked; it did ask
about some languages (stored procedure language, TCL, etc).
 
-Original Message- 
From: Mychael Scribner [mailto:[EMAIL PROTECTED] 
Sent: Thu 3/10/2005 2:40 PM 
To: Van Ingen, Lane; php-db@lists.php.net 
Cc: 
Subject: RE: [PHP-DB] PHP and PostgreSQL



save this to a php file and run it. I a attached file just in case.

?php
phpinfo();
?

This will give you all of the information you will need for you php 
installation.


-Original Message- 
From: Stephen Johnson [mailto:[EMAIL PROTECTED] 
Sent: Thu 3/10/2005 2:37 PM 
To: Van Ingen, Lane; php-db@lists.php.net 
Cc: 
Subject: Re: [PHP-DB] PHP and PostgreSQL

Did you compile php or did you install from a binary?

If you compiled -- did you configure the PHP module --with-pgsql?

I have not installed a binary in the past so I am not sure how you activate
the pgsql module in that regard.

The problem though is that the version of PHP you are running is not
configured to support pgsql and you will need to do that to get it recognize
the pgsql specific functions.


?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax)

continuing the struggle against bad code

*/
?

 From: Van Ingen, Lane [EMAIL PROTECTED]
 Date: Thu, 10 Mar 2005 14:32:39 -0500
 To: php-db@lists.php.net
 Subject: [PHP-DB] PHP and PostgreSQL

 I am new to PHP. Trying to install it and PostgreSQL 8.0 on Slackware Linux
 10.0.0 . I am getting
 the following error out of Apache:
   Fatal Error: Call to undefined function: pg_connect()

 After browsing your web site, I found http://us2.php.net/pgsql . But am unable
 to proceed because I
 am not sure what to do. Specific questions:
 (1) How do I determine what version of PHP I have? Browsed PHP directories,
 but couldn't find it.
 (2) The information I found said I could use a shared object module and/or
 (I think) alter php.ini .

 I don't think this is hard to fix, but I need to find a blow-by-blow of what
 to do. Can somebody help me?





[PHP-DB] PHP and PostgreSQL: Cannot create new link. Too many open links (0)

2004-01-28 Thread Johannes Alfänger
Hi All!

After working with PHP and MySQL and Firebird quite a while I need to
install PostgreSQL. After installation I made a new build of PHP to support
PostgreSQL. I looked over the ini files and re-started Apache.

With psql I can connect like: psql -h localhost  But not any chancen
seen with PHP. I even just made a small script with just two echo lines and
a pg_pconnect() / pg_connect().

This is the error Message I get: Warning: pg_pconnect(): Cannot create new
link. Too many open links (0). in /www/test.php on line 5.

I get this message no matter what connection string I use. Even if I leave
it totally blank or put some nonsense in, I get the same error.

Any hint appreciate - Thanks in advance! Johannes

Configuration:
Red Hat 9
PHP Version 4.3.4
Apache 2.0.48
PostgreSQL 7.3.4
PostgreSQL libpq 7.3.4

pg_hba.conf:
local  all  all trust
host all all 127.0.0.1 255.255.255.255 trust

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



[PHP-DB] PHP, Apache PostgreSQL

2001-07-20 Thread Sean McCoy

When I execute a pg_connect() in a .php file, I get an error indicating that
the function is not defined...

That's because, in the Apache error log I'm getting the following:

PHP Warning:  Unable to load dynamic library '/usr/lib/pgsql.so' -
libpq.so.2.0: cannot open shared object file: No such file or directory in
Unknown on line 0

I have confirmed that my pgsql.so and libpq.so.* files are in my directory
specified in the php.ini file. And that the exention for pgsql.so exists in
the php.ini also.

Would anyone know what I missed here?
Thanks,
Sean McCoy
[EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] PHP, Apache PostgreSQL

2001-07-20 Thread ORBZ Spam Report Reply

Results for 200.197.121.100:
This IP has been verified clean within the last 15 days.
It will not be checked again until this period expires
and another check request is made.
Results for 216.92.131.4:
This IP is already in queue for checking.
Results for 65.101.35.140:
This IP has been added to the queue for checking.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]