[freetds] Using PHP with FreeTDS

Daniel Fazekas fdsubs at t-online.hu
Thu May 31 16:00:19 EDT 2007


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


More information about the FreeTDS mailing list