First off, to compile dbtcp as a PHP extension, you’ll need to have phpize installed. I didn’t, so I opened up YAST and click on PHP’s devel package. A YAST dependency warning is thrown, click remove php-devel, press OK, select ignore and OK.
Extract archive to /usr/src/dbtcp
>cd /usr/src/dbtcp
Opened MakeFile and added -fPIC to CCFLAGS (line 11)
Opended dbug/dbug.c and commented out IMPORT int fprintf(); (line 210)
>make
>cd /usr/src/dbtcp/php/dbtcp
>phpize
>./configure –with-dbtcp=/usr/src/dbtcp
>make
>make install
Create a file, “/etc/php5/conf.d/dbtcp.ini” with contents of
extension=dbtcp.so
>service apache2 restart
At this point dbtcp is installed and “good to go” on the SuSe box. Let’s try it out!
Run DBTCP.exe
I went ahead and clicked on the “Allowed IPs” icon (it’s the icon with the bust of a person) and typed in the IPAddress of the SuSe box.
Okay back to SuSe. We need a quick PHP script to test things out…
print("Hello World\n $dsn = "DSN=Projects"; $handle = dbtcp_connect($dsn,$host); if(dbtcp_sql("SELECT * FROM sometable")) var_dump($handle);
");
$host = "10.10.10.10";
{
while($row = dbtcp_fetch_assoc())
var_dump($row);
}
?>
That’s it, you just saved yourself from buying a $1,500 driver