PHP still runs an enormous share of the world’s enterprise web software: Laravel back-offices, Symfony line-of-business apps, the internal portal every company has three of. When one of those needs data from IBM Netezza, the PHP developer’s only real option has been PDO_ODBC: install and configure a native ODBC driver manager at the operating-system level, point it at IBM’s client libraries, wrestle a DSN into shape, and then reach it through PDO’s lowest-common-denominator ODBC layer. It works, in the way that a bridge held together with brackets works.
We have replaced the bridge. Our PHP driver talks to Netezza through libnz, the open-source C client library we built as the foundation of this programme, using PHP’s own FFI extension. There is no ODBC driver manager, no DSN, and no compiled PHP extension to build and match to your PHP version. Enable FFI, put one shared library on the path, and query.
The foundation pays off
This is the first driver in the programme that does not reimplement the wire protocol at all. Every hard part – the handshake against both appliance generations, MD5 and SHA-256 authentication, decoding the appliance’s binary tuple format, external tables, TLS – lives in libnz, a C library we have already tested exhaustively. The PHP file is deliberately thin: it marshals PHP values across the FFI boundary and presents an idiomatic API, and that is all. When we fix or extend the protocol layer once, in C, this driver and every future FFI binding inherit it. That is exactly what a foundation library is for, and PHP is the proof.
The API is what a PHP developer expects: connect, query returning rows keyed by column name, queryParams for placeholders, execute returning an affected-row count. Values come back as strings with null for SQL NULL. Parameters are bound injection-safely inside libnz, quotes doubled, hostile input verified inert. Real table scans decode through the full type system including exact 38-digit numerics, the European encoding for CHAR and VARCHAR is handled correctly, and external tables move bulk data in both directions. All of it tested live against a classic NPS 7.2 rack and a current NPS 11.2 system.
One honest wrinkle, written down
PHP’s FFI has a quirk worth recording because it will bite the next person: PHP 8.0 auto-converts C const char* return values into PHP strings, and turns a NULL pointer into PHP null rather than the FFI CData NULL you would expect. A function returning a struct pointer can likewise hand back PHP null on failure. So the driver guards every pointer check for both shapes, and normalises string returns through one small helper. It is two lines of defensiveness that turn a portability landmine into a non-event, and precisely the kind of thing a shared driver should absorb so application code never sees it.
Honest edges
The driver needs ext-ffi enabled, which is a deliberate PHP configuration rather than a default, and libnz.so present on the host. For a controlled application server that is a one-time setup step; for shared hosting it may not be available, in which case the ODBC bridge remains the fallback. Packagist publication is coming soon, so a single composer require will pull the PHP layer, with libnz alongside it.
The protocol should be solved once, in one language, and borrowed everywhere else. PHP borrows it in about two hundred lines.
Where you get it
We did not build this for ourselves. Our software is written in Python, so nothing in our stack uses it; it exists because the gap did, and because other teams kept falling into it. If a Laravel or Symfony app in your estate reaches Netezza through an ODBC DSN nobody wants to touch, there is now a native path. Talk to us if you want it in your own estate.
Built from the published open source Netezza drivers (IBM/nzpy and IBM/nzalchemy under Apache-2.0, IBM/nzgo under MIT), verified live against both NPS 7.2 and NPS 11.2, and produced without decompiling, disassembling or inspecting any IBM proprietary binary.
Running Netezza? Let’s talk. Smart Associates has been engineering on IBM Netezza for two decades: disaster recovery, migrations, performance and the deep platform work in between. If any of the above sounds familiar, why not get in touch.
