Skip to Content.
Sympa Menu

freetds - Re: [freetds] Using PHP with FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Paquin <brian.paquin AT yale.edu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Using PHP with FreeTDS
  • Date: Fri, 01 Jun 2007 11:06:39 -0400

Daniel,

TDSDUMP generates a LOT of output!!
( I redirected the output to a file. When the file reached 2GB,
I killed the job and reviewed file.)
Basically, from what I can tell, it starts fine...
Connects to the database and receives the first packet
of database results. After those lines, it seems like a lot of
repetition (see attached file "log.txt"). Is this output normal?


As for the other suggestions and questions:

I used "php -i" to retrieve the config used by Apple, downloaded PHP 4.4.4
from php.net, and then rebuilt it (adding in the sybase directive).

Changing the memory limit to 32M did not change the behavior.
(changed php.ini and restarted apache)

otool confirms that FreeTDS is present...
intranet:/Library/WebServer/Documents administrator$ otool -L $ (command -v php)
/usr/bin/php:
/usr/local/lib/libsybdb.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.10.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/usr/lib/libcurl.3.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.7)
/usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
intranet:/Library/WebServer/Documents administrator$ otool -L /usr/ libexec/httpd/libphp4.so
/usr/libexec/httpd/libphp4.so:
/usr/local/lib/libsybdb.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.10.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/usr/lib/libcurl.3.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.7)
/usr/lib/libssl.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)
/usr/lib/libcrypto.0.9.7.dylib (compatibility version 0.9.7, current version 0.9.7)

Thank you for all your help!!

Brian :)

On May 31, 2007, at 4:00 PM, Daniel Fazekas wrote:

On May 31, 2007, at 20:13, Brian Paquin wrote:

The timeouts are browser generated.
But when I run the script from the command line I get:
intranet:/Library/WebServer/Documents user$ php dem.php
php(24248) malloc: *** vm_allocate(size=1069056) failed (error code=3)
php(24248) malloc: *** error: can't allocate region
php(24248) malloc: *** set a breakpoint in szone_error to debug
FATAL: emalloc(): Unable to allocate 9 bytes

Nice, it doesn't work there either. The easier it is to reproduce a problem, the closer you are to fixing it. :)

You could now try following this up with:
For example, you can just dump the debug output to the terminal:
TDSDUMP=stdout php script.php

Or in your case,
TDSDUMP=stdout php dem.php

Although those PHP error messages seem to suggest your problem is not related to FreeTDS and more likely to be something wrong in your PHP installation; you might not even get any TDS debug output as a result.

Both old and new servers have the following resource limits in php.ini:
memory_limit = 8M

An 8 megabyte limit is certainly not much, even a script working normally could exhaust that. I'd try increasing this to 16M or 32M.

If that doesn't help, then we'll have to look into that PHP installation in more detail.
Things such as making sure the version of PHP you think is executed is really the one being used, or that the sybase extension was built correctly.
All you said about that so far is:
I have recompiled the built-in PHP to include "--with-sybase=/usr/ local" (where FreeTDS is installed).

I assume that means you built the sybase extension into the main PHP binaries, rather than making it a dynamically loadable shared extension.
So it's the main PHP binaries where we should check for the proper dependencies on the FreeTDS libs:

otool -L $(command -v php)
and
otool -L /usr/libexec/httpd/libphp4.so
(libphp5.so for PHP 5)

Both should reference FreeTDS's
/usr/local/lib/libsybdb.5.dylib

What version of PHP is this, anyway?
What do you mean by recompiling the built-in PHP?

You just grabbed Apple's old copy of PHP and their patches & stuff from the darwinsource site:
http://www.opensource.apple.com/darwinsource/10.4.9.ppc/ apache_mod_php-18.8/
…and tried to recreate Apple's version based on that?

More details please.

--
fds_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_________________________________________
Brian T. Paquin, ACSA, ACHDS, ACTC, ACDT, ACPT
Yale University
Department of Pathology
brian.paquin AT yale.edu
(203) 785-3691






Archive powered by MHonArc 2.6.24.

Top of Page