Jump to content
The Uniform Server Community
jacob lee

Firebird support

Recommended Posts

Recently I just had success on installing Firebird on the uniform server. If you want to use firebird as your database engine this article might give you a method if you don't know how to.

 

1. download firebird server uninstall version and uncompress the zip to the uniform server\udrive\usr\local and change the newly created folder name to firebird.

 

2. set folder where you save firebird database files. I set up like this: \udrive\var\firebird

 

3. open start_server.bat and find a line like:

start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf

 

4. under that line write down:

start \usr\local\firebird\bin\fbserver.exe -a

(it means we run firebird as an application not a service)

 

5. save the file.

 

6. check whether you have php_interbase.dll in your php extension folder. if not you have to get it from php.net. if you want to use pdo then you need php_pdo_firebird.dll also.

 

7. open php.ini and find extension option and add: extension=php_interbase.dll

if you want to use pdo then add also: extension=php_pdo_firebird.dll

 

8. add to php.ini:

[InterBase]
ibase.allow_persistent PHP_INI_SYSTEM
ibase.max_persistent PHP_INI_SYSTEM
ibase.max_links PHP_INI_SYSTEM
ibase.default_db PHP_INI_SYSTEM
ibase.default_user PHP_INI_ALL
ibase.default_password PHP_INI_ALL
ibase.default_charset PHP_INI_ALL
ibase.timestampformat PHP_INI_ALL
ibase.dateformat PHP_INI_ALL
ibase.timeformat PHP_INI_ALL

 

9. "Strings in Firebird are delimited by a pair of single quote (apostrophe) symbols", so if you want convenience change the value of "magic_quotes_sybase" to "On"

 

10. save php.ini

 

11. open stop_server.bat and find the line:

udrive\home\admin\program\pskill.exe Apache.exe c

 

12. add under that line:

udrive\home\admin\program\pskill.exe fbserver.exe c

(there is no way except we shutdown the server by using the tray icon. so we use pskill to kill the process by force.)

 

13. download the ibWebAdmin from sourceforge.net and unzip to ..\udrive\home\admin\www

 

14. open ibWebAdmin\inc\configuration.inc.php and change some values like:

 

define('BINPATH', '/usr/local/firebird/bin/');
define('SECURITY_DB', '/usr/local/firebird/security2.fdb');
define('TMPPATH', '/tmp/');

 

define('DEFAULT_PATH',	'/var/firebird/'); 

=> for here we created \var\firebird folder!

 

define('DEFAULT_HOST',	'localhost');

 

define('DEFAULT_CACHE',   8192); 

=> for better caching

 

define('DEFAULT_SERVER',  'FB_2.0');

$ALLOWED_DIRS = array('/var/firebird/',
				  '/tmp/');

define('BACKUP_DIR', '/var/firebird/backup/'); 

=> for this I created \var\firebird\backup folder!

 

14. save configuration.inc.php

 

15. open ..\udrive\usr\local\firebird\firebird.conf and change some values like:

 

RootDirectory = \usr\local\firebird

DatabaseAccess = Restrict W:\usr\local\firebird;W:\var\firebird;W:\var\firebird\backup

TempDirectories = /tmp

DefaultDbCachePages = 8192

 

(be careful when you define the DatabaseAccess, it should have the drive letter "W:", otherwise the firebird gives you error.)

 

16. save firebird.conf

 

17. open ..\udrive\home\admin\www\includes\tool.inc and find line:

<a target="_phpmyadmin" onclick="h(this);" href="<?=$apanel?>/phpMyAdmin/"><?=$US['nav-pma']?></a>

 

18. add next :

<a target="_ibwebadmin" onclick="h(this);" href="<?=$apanel?>/ibWebAdmin/"><?=$US['nav-ibwa']?></a>

 

19. open ..\udrive\home\admin\www\includes\server.inc and find line:

<a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/smysql.cgi"><?=$US['nav-smysql']?></a>

 

20. add next :

<a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/rfirebird.cgi"><?=$US['nav-rfirebird']?></a>
<a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/sfirebird.cgi"><?=$US['nav-sfirebird']?></a>

 

21. open ..\udrive\home\admin\www\cgi-bin\includes\lang\en\sserver.cgi and find:

	system "/home/admin/program/uniserv.exe \"\\usr\\local\\mysql\\bin\\mysqladmin.exe --user=root --password=$password shutdown\"";
}

22. add next:

$res = system "\\home\\admin\\program\\pskill.exe", "fbserver.exe";

if ($res == 0){
  system "/home/admin/program/pskill.exe fbserver.exe c";
}

 

23. save sserver.cgi

 

24. make rfirebird.cgi file in the same folder and the contents are:

 

#!/usr/bin/perl

require header;
require secure;

print "
<div id=\"main\">
<h2>» Start Firebird</h2>
<h3>Starting Firebird</h3>
<p>";

&check_Firebird;
if ($run) {
  if ($ENV{'QUERY_STRING'}eq"F"){
	&start_Firebird;
	print "Firebird server was forced to start.";
	print "<br />";
  }

  else {
	print <<ENDDD;
	Firebird server already running.
	<br />
	But if you think that it is mistake click on this <a href="$ENV{SCRIPT_NAME}?F">link</a>
	<br />
	</p>
		</div>
ENDDD
  }
} 

else {
  print <<ENDDD;
  Firebird server started.
  </p>
  </div>
ENDDD
  require footer;
  &start_Firebird;
}

require footer;

exit;

sub check_Firebird(){
	$res = system "\\home\\admin\\program\\pskill.exe", "fbserver.exe";
	if ($res == 0){$run=1} 
else {$run=0}
}

sub start_Firebird(){
	exec "/usr/local/firebird/bin/fbserver.exe -a";
}

 

25. make sfirebird.cgi file in the same folder and the contents are:

 

#!/usr/bin/perl

require header;
require secure;

print "
<div id=\"main\">
<h2>» Stop Firebird</h2>
<h3>Stopping Firebird</h3>
<p>";

&check_Firebird;
if ($run) {
  &stop_Firebird;
  print "Firebird server stopped.<br>";
} 

else {
  if ($ENV{'QUERY_STRING'}eq"F"){
	&stop_Firebird;
	print "Firebird server was forced to stop.";
	print "<br>";
  } 

  else {
	print <<ENDDD;
	Firebird server was not running.
	<br />
	But if you think that it is a mistake click on this <a href="$ENV{SCRIPT_NAME}?F">link</a>
	<br />
ENDDD
  }
}

print <<ENDDD;
</p>
</div>
ENDDD

require footer;

exit;

sub check_Firebird(){
	$res = system "\\home\\admin\\program\\pskill.exe", "fbserver.exe";
	if ($res == 0){$run=1} 
else {$run=0}
}
sub stop_Firebird(){
  system "/home/admin/program/pskill.exe fbserver.exe c";
}

 

26. open \udrive\home\admin\www\includes\lang\en.php add in the code:

	'nav-rfirebird' => 'Run Firebird',
'nav-sfirebird' => 'Stop Firebird',

'nav-ibwa' => 'ibWebAdmin',

Still you need to learn how to use firebird becuase it is quite different from mysql.

Share this post


Link to post
Share on other sites

What an excellent write-up. I followed all your steps to the letter used cut and paste for the long lines.

 

I think I am using the correct version! Had a real problem at the end. Anyway thought I would add my comments:

 

1) Download from: http://sourceforge.net/project/showfiles.php?group_id=9028

 

Under folder:

firebird-win32

Firebird-2.1.0.17755-0_Win32.zip

 

Save Firebird-2.1.0.17755-0_Win32.zip to any folder.

 

6) Both need to be downloaded: php_interbase.dll and php_pdo_firebird.dll

 

13) Download ibwebadmin from:

 

http://sourceforge.net/projects/ibwebadmin/

 

file: ibWebAdmin_1.0.2.zip

 

Save to any folder then extract to folder *\Uniform Server\udrive\home\admin\www\ibWebAdminwww.

 

On starting the servers I received the following error message: “Application failed to start gds32.dll not found”

 

Solution:

Copy file fbclient.dll located in *\Uniform Server\udrive\usr\local\firebird\bin

To folder: *\Uniform Server\udrive\usr\local\php

Rename the copied file to: gds32.dll

 

Run ibWebAdmin from apanel or type

http://localhost/apanel/ibWebAdmin/database.php

 

This will display the database administration page (green theme).

 

Like I said an excellent write-up just wondering if I was using the correct version because of that error message.

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Right! I forgot to mention that!. and if any of you install any previous firebird as a service already, then shutdown the firebird server and delete gds32.dll in system32 and copy the new fbclient.dll to php folder and copy it again as a name "gds32.dll" for compatibility.

 

thanks for mention that!.

Share this post


Link to post
Share on other sites

Thanks for the reply, so I picked-up the correct files.

I confess to not having a clue how to run this server however I managed to get the example database running.

 

I copied the two files in folder:

 

*\Uniform Server\udrive\usr\local\firebird\examples\empbuild

 

Files: employe2.sql and EMPLOYEE.FDB

 

To folder: *\Uniform Server\udrive\var\firebird

 

I was able to login to the EMPLOYEE.FDB database using ibWebAdmin using the following password masterkey

 

I like alternatives, if only I had time certainly would give this a spin. :)

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

One more thing needed.

 

If you encounter 'too many open links(0)' error or 'Undefined service gds_db/tcp' error then

add the following line to %SystemRoot%\system32\drivers\etc\services

gds_db		   3050/tcp						   #InterBase Server

 

or use my php:

<?php

// Installs gds_db port to services file

$system_root = getenv('SystemRoot');

$service_file = $system_root.'system32'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR.'etc'.DIRECTORY_SEPARATOR.'services';

$lines = file($service_file);

foreach ($lines as $line) {
if (strpos($line, 'gds_db') !== false) {
	exit('gds_db port is already installed.');
}
}

$fp = fopen($service_file, 'a');

fwrite($fp, "\r\ngds_db		   3050/tcp						   #InterBase Server");

fclose($fp);

echo "gds_db port is successfully installed.";

?>

 

actually I changed my code to check gds_db port whenever I start the server and install gds_db if it is not installed.

Share this post


Link to post
Share on other sites

Recently I just had success on installing Firebird on the uniform server. If you want to use firebird as your database engine this article might give you a method if you don't know how to.

Hi Jacob,

 

There must be some curse on Firebird.

 

I spent 3 weeks trying to install Perl DBD for Firebird with no luck.

 

It seems like all required files disappear (or are removed...)

 

I cannot find "Firebird-2.1.0.17755-0_Win32.zip" and so on.

 

Would you have a copy of all required files for me please?

 

Thank you.

 

Best Regards,

Emil

Share this post


Link to post
Share on other sites

Isn't Firebird the same as phpmyadmin? What are pros and cons? Or am I totally wrong?

Share this post


Link to post
Share on other sites

Isn't Firebird the same as phpmyadmin? What are pros and cons? Or am I totally wrong?

 

Just as you said: totally wrong :)

 

Firebird is a database engine, like MySQL and others, and it has its good points.

Quoting from the site (http://www.firebirdsql.org/):

"Firebird is a relational database offering many ANSI SQL standard features that runs on Linux, Windows, and a variety of Unix platforms. Firebird offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers. It has been used in production systems, under a variety of names, since 1981."

 

NOTE!!! The instructions for Firebird shown above are two years old. I personally haven't tested any of it, and Ric has been otherwise engaged (like, with MongoDB). The main site shows that version 2.5 has been release, and appears to be MUCH faster for large DBs. We're talking >20GB here.

 

All-in-all, Uniform Server is a pretty good base for testing, but sliding in new DB engines is outside the norm for most users. Hope that gives some background.

 

Regards,

BobS

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...