If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

PHP + Apache + DB2 slow odbc_connect

Hi,

I'm using a script with odbc_connect in order to connect to a remote DB2 instance. When the script is executed from command line everything works as expected, but when the same script is executed using Apache web server the call to odbc_connect is extremely slow.

I've compared the php.ini for CLI and for Apache and the configuration of memory and ODBC are the same in both files.

I'm assuming you're running on a Windows platform-- which OS version? And what versions of PHP and Apache are you using exactly-- what install packages? Did you match the compilers up between PHP and Apache? (VC6 vs. VC9) That will all have an impact.

I'm assuming you're running on a Windows platform-- which OS version? And what versions of PHP and Apache are you using exactly-- what install packages? Did you match the compilers up between PHP and Apache? (VC6 vs. VC9) That will all have an impact.

I've tested this behavior in Ubuntu 12.10 and also in a Centos server.

This reeks of communication. And what spot, not sure.
PDO appears to have generics compatible with DB2: http://ca2.php.net/manual/en/ref.pdo-odbc.php, so I'd suggest you establish the connection via PDO to the DB2 db, and see how that goes.
If its still slow via httpd, I'd suggest that its definitely communication. Make sure you are working through local (assuming local yeah?) connections and not attempting to go offsite. Check the iptables, firewall or whatever you are using to block to make sure that its not being bottlenecked there.

If it fixes the problem, I'd suggest an issue in the odbc package itself. In which case I'd suggest not to bother with the odbc. I don't believe that the package is deprecated, but it is getting rather antiquated.

Typically you will see better performance on direct CLI, but not like 1/150th of a difference. More like 20% savings being normal.