Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Delphi For PHP > Tutorials
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

Tutorials This forum focuses on showing people how to do things in Delphi for PHP including step by step how-to guldes and screencasts etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 27th March 2009, 19:30
D4PHP Guru
 
Join Date: Nov 2007
Posts: 223
u.masotti is on a distinguished road
Arrow How to connect to a Firebird db server from Delphi for PHP

Firebird is supported by PHP, and Delphi for PHP can support it, but it can't out of the box.
What is not well documented about a Delphi for PHP to Firebird connection, is the fact that names of libraries can overlap in WIndows.
In this first post, I'd put a foreword to clarify situation.

PHP has a set of functions' libraries to "expand" his language. Well, in Windows package, php_interbase.dll is one of these interface libs.

For historical reasons php_interbase.dll (as released in Windows PHP package) searches for the Interbase/Firebird "compatible" client library named GDS32.DLL.

When all this started, some years ago, wasn't so problematic, because there were complete or almost good compatibility between client lib (i.e. gds32.dll) and any of two servers.

Some time after, Firebird and Interbase projects forked in a manner that Interbase newer version ( > 6.5 ) were no more compatible with newer Firebird's version ( >= 1.5 ).

So Firebird project changed GDS32.DLL name to FBCLIENT.DLL maintaing the possibility to install it as GDS32.DLL for older programs compatibility purposes. Note that the client library's interface to application program has compatible interface, but speakes to server in different language: this is why Firebird server doesn't communicate correctly with Interbases's client lib.

I did already post solution somewhere in the web, but I'll put in next post trying to write clearer.
__________________
Ciao.
Mimmo.

Last edited by u.masotti; 27th March 2009 at 21:02. Reason: Better explanation of (in)compatibilities.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 27th March 2009, 20:47
D4PHP Guru
 
Join Date: Nov 2007
Posts: 223
u.masotti is on a distinguished road
Default Howto connect Firebird db: the pratical section.

When Delphi for PHP installs, it installs IDE, PHP, Apache server, PHP debugger, and a lot of other small pieces of software.
Among them there are the so called "database client libraries", that aren't part of PHP, but are part of database's servers software package. So you'll be able to find the client libraries from Oracle, MsSQL, MySql, Sybase, Interbase and so on.
And Firebird?

Actually Firebird's client lib is called fbclient.dll, and you cannot find it in Delphi for PHP installation dir, as it is out of the box. Ok, you can say, instead I found GDS32.DLL: I can copy FBCLIENT.DLL in the same directory and I'd solve problem.
No, this is not a solution: no piece in Windows PHP package searches for fbclient.dll.
PHP interface library, as stated before, searches for GDS32.DLL only, and that is Interbase client lib.

Anyway, you don't ever need Firebird's GDS32.DLL in Delphi for PHP subdirectories: you need to install it properly only in system directories because this is a piece of software maintained from Firebird installation system, not from D4PHP.

So there are two simple step to get Firebird working:
  1. Remove Interbase's GDS32.DLL. To do so, you need only to rename it, wherever is.
  2. Install Firebird's GDS32.DLL, and you need to force installation only in system directory.
I suppose you are on Windows XP, using Delphi for PHP 2.0 and Firebird 2.1. If this is not the case, adjust operation and/or directory names accordingly. Also convert names of programs' folder in your language.
Step 1.
  1. Exit from the D4PHP IDE, if you have it opened.
  2. Explore to Delphi for PHP installation dir, i.e. something like C:\Program Files\CodeGear\Delphi for PHP\2.0
  3. Click on the Search button
  4. Search for all file named "GDS32.DLL" contained there and in subdirectories.You'll find four of them, i.e. four identical copies of the same file!
  5. Rename all of them to something evident, like GDS32_IB.DLL
  6. Close explorer window

Step 2.
  1. Open a terminal window.
  2. Change to Firebird installation bin directory, i.e. something like C:\Program Files\Firebird\Firebird2_1\bin
  3. Type the command
    Code:
    instclient -f i g
    (note the spaces between -f and i, and between i and g)
  4. To verify correct driver installation, type command
    Code:
    instclient q g
  5. Close terminal window typing command
    Code:
    exit

Now you can connect Firebird through ibase_* native set of functions, or trough native components (Database and Query) setting database driver as "firebird".

Hope that this guide will help people developing in Delphi for PHP that is using Firebird as database server.
__________________
Ciao.
Mimmo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 29th July 2009, 19:21
just Joined!
 
Join Date: Jul 2009
Posts: 1
coolmike is on a distinguished road
Default it's not quite working for me

Hello,

I have followed your instructions, combined with the Embarcadero 'Creating a Database' instructions. I can connect to the employee database in the Data Explorer, but when I try to run the app as suggested in the 'Creating a Database' guide, all I get is a blank page.

I should add that I am successfully running Firebird with php on this PC. I'm not sure what the trouble is. What additional information would you need to help me? Alternatively, how do I go about troubleshooting this problem?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 6th August 2009, 19:20
D4PHP Guru
 
Join Date: Nov 2007
Posts: 223
u.masotti is on a distinguished road
Default

Sorry for late answer.

Quote:
Originally Posted by coolmike View Post
when I try to run the app as suggested in the 'Creating a Database' guide, all I get is a blank page.
Try to raise error level in the first lines of your page: there are possibilities that errors aren't output because they are filtered by PHP.
Add these two lines as the very first of your script.
PHP Code:
ini_set("display_errors",1);
error_reporting(E_ALL); 
Try to scan HTML source to see if there are messages hidden by other visulized components (remember that objects with absolute positioning and greater z-order can hide other elements)

A completely blank page smell like a PHP fatal syntax error.
__________________
Ciao.
Mimmo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 03:39.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use