Installing Firebird: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
No edit summary
m (Reverted edits by Upazixorys (Talk); changed back to last version by Letsgolee)
Line 1: Line 1:
=[http://awuhodynaro.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
== Introductions ==
== Introductions ==
The following method is a little changed from that which I explained in http://forum.uniformserver.com. You can see the previouse one clicking [http://forum.uniformserver.com/index.php?showtopic=1433 here].
The following method is a little changed from that which I explained in http://forum.uniformserver.com. You can see the previouse one clicking [http://forum.uniformserver.com/index.php?showtopic=1433 here].


Thanks to the policy of Firebird that it allows the server run as an application we can install firebird into Uniform Server. the key is adding "-a" after fbserver.exe command: '''fbserver.exe -a'''.
Thanks to the policy of Firebird that it allows the server run as an application we can install firebird into Uniform Server. the key is adding "-a" after fbserver.exe command: '''fbserver.exe -a'''.


Firebird is open source and supports many options and syntaxes more than mysql. Still there are not many who use firebird as an web-based server. because of that I also had a hard time to use it. To many of us Mysql is a great option to use but it's not open source. I spent my time to install firebird to Uniform server and I just want to be a helper to them who want to use firebird as a portable database server.
Firebird is open source and supports many options and syntaxes more than mysql. Still there are not many who use firebird as an web-based server. because of that I also had a hard time to use it. To many of us Mysql is a great option to use but it's not open source. I spent my time to install firebird to Uniform server and I just want to be a helper to them who want to use firebird as a portable database server.
Line 10: Line 9:


== Install Firebird Server ==
== Install Firebird Server ==
Visit http://www.firebirdsql.org and download the latest firebird no-install version and uncompress the zip to the uniform server\udrive\usr\local and change the newly created folder name to firebird. Here is the [http://sourceforge.net/project/downloading.php?groupname=firebird&filename=Firebird-2.1.0.17798-0_Win32.zip&use_mirror=nchc&testing=1 link] for firebird v.2.1.0.17798.
Visit http://www.firebirdsql.org and download the latest firebird no-install version and uncompress the zip to the uniform server\udrive\usr\local and change the newly created folder name to firebird. Here is the [http://sourceforge.net/project/downloading.php?groupname=firebird&filename=Firebird-2.1.0.17798-0_Win32.zip&use_mirror=nchc&testing=1 link] for firebird v.2.1.0.17798.


Make a folder where you want to save firebird database files like: \udrive\var\firebird
Make a folder where you want to save firebird database files like: \udrive\var\firebird


== Edit start_server.bat ==
== Edit start_server.bat ==
Open start_server.bat and find a line like:<pre>start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf</pre>
Open start_server.bat and find a line like:<pre>start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf</pre>


Under that line write down and save:  
Under that line write down and save:  
&lt;pre&gt;start \usr\local\firebird\bin\fbserver.exe -a&lt;/pre&gt;
<pre>start \usr\local\firebird\bin\fbserver.exe -a</pre>


== Edit php.ini ==
== Edit php.ini ==
Line 25: Line 24:
Open php.ini and find extension option and uncomment extension=php_interbase.dll. If you want to use pdo then uncomment extension=php_pdo_firebird.dll also.
Open php.ini and find extension option and uncomment extension=php_interbase.dll. If you want to use pdo then uncomment extension=php_pdo_firebird.dll also.


Add the following to php.ini:&lt;pre&gt;&lt;nowiki&gt;[InterBase]
Add the following to php.ini:<pre><nowiki>[InterBase]
ibase.allow_persistent =
ibase.allow_persistent =
ibase.max_persistent =  
ibase.max_persistent =  
Line 35: Line 34:
ibase.timestampformat =
ibase.timestampformat =
ibase.dateformat =
ibase.dateformat =
ibase.timeformat =&lt;/nowiki&gt;&lt;/pre&gt;The value is not given. set your own value if you want. Blank means default value will be used.
ibase.timeformat =</nowiki></pre>The value is not given. set your own value if you want. Blank means default value will be used.


&quot;Strings in Firebird are delimited by a pair of single quote (apostrophe) symbols&quot;, so if you want convenience change the value of &quot;magic_quotes_sybase&quot; to &quot;On&quot;
"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"


== Edit Close.bat ==
== Edit Close.bat ==
Open \udrive\home\admin\program\Close.bat and find the line:
Open \udrive\home\admin\program\Close.bat and find the line:
&lt;pre&gt;:nomysql&lt;/pre&gt;
<pre>:nomysql</pre>
Add under:
Add under:
&lt;pre&gt;%Disk%:\home\admin\program\pskill.exe fbserver.exe
<pre>%Disk%:\home\admin\program\pskill.exe fbserver.exe
IF ERRORLEVEL 1 goto nofirebird
IF ERRORLEVEL 1 goto nofirebird
%Disk%:\home\admin\program\pskill.exe fbserver.exe c
%Disk%:\home\admin\program\pskill.exe fbserver.exe c
:nofirebird&lt;/pre&gt;
:nofirebird</pre>


Firebird tray icon will be shown so we can shutdown the server using tray icon but we want the database server to be shutdowned when we finish the Uniform server. So we use pskill to kill the process by force.
Firebird tray icon will be shown so we can shutdown the server using tray icon but we want the database server to be shutdowned when we finish the Uniform server. So we use pskill to kill the process by force.
Line 54: Line 53:


Open ibWebAdmin\inc\configuration.inc.php and change some values like:
Open ibWebAdmin\inc\configuration.inc.php and change some values like:
&lt;pre&gt;define('BINPATH', '/usr/local/firebird/bin/');
<pre>define('BINPATH', '/usr/local/firebird/bin/');
define('SECURITY_DB', '/usr/local/firebird/security2.fdb');
define('SECURITY_DB', '/usr/local/firebird/security2.fdb');
define('TMPPATH', '/tmp/');&lt;/pre&gt;
define('TMPPATH', '/tmp/');</pre>
&lt;pre&gt;define('DEFAULT_PATH',    '/var/firebird/');&lt;/pre&gt;
<pre>define('DEFAULT_PATH',    '/var/firebird/');</pre>
We already created \var\firebird folder for saving database!
We already created \var\firebird folder for saving database!
&lt;pre&gt;define('DEFAULT_HOST',    'localhost');&lt;/pre&gt;
<pre>define('DEFAULT_HOST',    'localhost');</pre>
&lt;pre&gt;define('DEFAULT_CACHE',  8192); &lt;/pre&gt;
<pre>define('DEFAULT_CACHE',  8192); </pre>
for better caching. You can change that.
for better caching. You can change that.
&lt;pre&gt;define('DEFAULT_SERVER',  'FB_2.0');
<pre>define('DEFAULT_SERVER',  'FB_2.0');


$ALLOWED_DIRS = array('/var/firebird/',
$ALLOWED_DIRS = array('/var/firebird/',
                       '/tmp/');&lt;/pre&gt;
                       '/tmp/');</pre>
&lt;pre&gt;define('BACKUP_DIR', '/var/firebird/backup/'); &lt;/pre&gt;
<pre>define('BACKUP_DIR', '/var/firebird/backup/'); </pre>
You need to create \var\firebird\backup for backup folder.
You need to create \var\firebird\backup for backup folder.


== Edit Firebird configuration ==
== Edit Firebird configuration ==
Open \udrive\usr\local\firebird\firebird.conf and change some values like:
Open \udrive\usr\local\firebird\firebird.conf and change some values like:
&lt;pre&gt;RootDirectory = \usr\local\firebird&lt;/pre&gt;
<pre>RootDirectory = \usr\local\firebird</pre>
&lt;pre&gt;DatabaseAccess = Restrict W:\usr\local\firebird;W:\var\firebird;W:\var\firebird\backup&lt;/pre&gt;
<pre>DatabaseAccess = Restrict W:\usr\local\firebird;W:\var\firebird;W:\var\firebird\backup</pre>
Be careful when you define the DatabaseAccess, it should have the drive letter &quot;W:&quot;, otherwise the firebird gives you error.
Be careful when you define the DatabaseAccess, it should have the drive letter "W:", otherwise the firebird gives you error.
&lt;pre&gt;TempDirectories = /tmp
<pre>TempDirectories = /tmp


DefaultDbCachePages = 8192&lt;/pre&gt;
DefaultDbCachePages = 8192</pre>


== Edit Uniform Admin Panel Files ==
== Edit Uniform Admin Panel Files ==
Open \udrive\home\admin\www\includes\tool.inc and find line:  
Open \udrive\home\admin\www\includes\tool.inc and find line:  
&lt;pre&gt;&lt;a target=&quot;_phpmyadmin&quot; onclick=&quot;h(this);&quot; href=&quot;&lt;?=$apanel?&gt;/phpMyAdmin/&quot;&gt;&lt;?=$US['nav-pma']?&gt;&lt;/a&gt;&lt;/pre&gt;
<pre><a target="_phpmyadmin" onclick="h(this);" href="<?=$apanel?>/phpMyAdmin/"><?=$US['nav-pma']?></a></pre>
Add next:  
Add next:  
&lt;pre&gt;&lt;a target=&quot;_ibwebadmin&quot; onclick=&quot;h(this);&quot; href=&quot;&lt;?=$apanel?&gt;/ibWebAdmin/&quot;&gt;&lt;?=$US['nav-ibwa']?&gt;&lt;/a&gt;&lt;/pre&gt;
<pre><a target="_ibwebadmin" onclick="h(this);" href="<?=$apanel?>/ibWebAdmin/"><?=$US['nav-ibwa']?></a></pre>
Open \udrive\home\admin\www\includes\server.inc and find line:  
Open \udrive\home\admin\www\includes\server.inc and find line:  
&lt;pre&gt;&lt;a target=&quot;content&quot; onclick=&quot;h(this);&quot; href=&quot;&lt;?=$apanel?&gt;/cgi-bin/includes/lang/&lt;?=file_get_contents(&quot;includes/.lang&quot;);?&gt;/smysql.cgi&quot;&gt;&lt;?=$US['nav-smysql']?&gt;&lt;/a&gt;&lt;/pre&gt;
<pre><a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/smysql.cgi"><?=$US['nav-smysql']?></a></pre>
Add next:  
Add next:  
&lt;pre&gt;&lt;a target=&quot;content&quot; onclick=&quot;h(this);&quot; href=&quot;&lt;?=$apanel?&gt;/cgi-bin/includes/lang/&lt;?=file_get_contents(&quot;includes/.lang&quot;);?&gt;/rfirebird.cgi&quot;&gt;&lt;?=$US['nav-rfirebird']?&gt;&lt;/a&gt;
<pre><a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/rfirebird.cgi"><?=$US['nav-rfirebird']?></a>
&lt;a target=&quot;content&quot; onclick=&quot;h(this);&quot; href=&quot;&lt;?=$apanel?&gt;/cgi-bin/includes/lang/&lt;?=file_get_contents(&quot;includes/.lang&quot;);?&gt;/sfirebird.cgi&quot;&gt;&lt;?=$US['nav-sfirebird']?&gt;&lt;/a&gt;&lt;/pre&gt;
<a target="content" onclick="h(this);" href="<?=$apanel?>/cgi-bin/includes/lang/<?=file_get_contents("includes/.lang");?>/sfirebird.cgi"><?=$US['nav-sfirebird']?></a></pre>
Open \udrive\home\admin\www\cgi-bin\includes\lang\en\sserver.cgi and find:
Open \udrive\home\admin\www\cgi-bin\includes\lang\en\sserver.cgi and find:
&lt;pre&gt;   system &quot;/home/admin/program/uniserv.exe \&quot;\\usr\\local\\mysql\\bin\\mysqladmin.exe --user=root --password=$password shutdown\&quot;&quot;;
<pre>   system "/home/admin/program/uniserv.exe \"\\usr\\local\\mysql\\bin\\mysqladmin.exe --user=root --password=$password shutdown\"";
}&lt;/pre&gt;
}</pre>
Add next:
Add next:
&lt;pre&gt;$res = system &quot;\\home\\admin\\program\\pskill.exe&quot;, &quot;fbserver.exe&quot;;
<pre>$res = system "\\home\\admin\\program\\pskill.exe", "fbserver.exe";


if ($res == 0){
if ($res == 0){
       system &quot;/home/admin/program/pskill.exe fbserver.exe c&quot;;
       system "/home/admin/program/pskill.exe fbserver.exe c";
}&lt;/pre&gt;
}</pre>
Open \udrive\home\admin\www\includes\lang\en.php add in the code:
Open \udrive\home\admin\www\includes\lang\en.php add in the code:
&lt;pre&gt;   'nav-rfirebird' =&gt; 'Run Firebird',
<pre>   'nav-rfirebird' => 'Run Firebird',
     'nav-sfirebird' =&gt; 'Stop Firebird',
     'nav-sfirebird' => 'Stop Firebird',


     'nav-ibwa' =&gt; 'ibWebAdmin',&lt;/pre&gt;
     'nav-ibwa' => 'ibWebAdmin',</pre>


== Create Files ==
== Create Files ==
Create rfirebird.cgi file in the \udrive\home\admin\www\cgi-bin\includes\lang\en:
Create rfirebird.cgi file in the \udrive\home\admin\www\cgi-bin\includes\lang\en:
&lt;pre&gt;#!/usr/bin/perl
<pre>#!/usr/bin/perl


require header;
require header;
require secure;
require secure;


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


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


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


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


Line 151: Line 150:


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


sub start_Firebird(){
sub start_Firebird(){
     exec &quot;/usr/local/firebird/bin/fbserver.exe -a&quot;;
     exec "/usr/local/firebird/bin/fbserver.exe -a";
}&lt;/pre&gt;
}</pre>
Create sfirebird.cgi file in \udrive\home\admin\www\cgi-bin\includes\lang\en:
Create sfirebird.cgi file in \udrive\home\admin\www\cgi-bin\includes\lang\en:
&lt;pre&gt;#!/usr/bin/perl
<pre>#!/usr/bin/perl


require header;
require header;
require secure;
require secure;


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


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


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


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


print &lt;&lt;ENDDD;
print <<ENDDD;
&lt;/p&gt;
</p>
&lt;/div&gt;
</div>
ENDDD
ENDDD


Line 204: Line 203:


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


== Copy DLL ==
== Copy DLL ==
Line 223: Line 222:
If you encounter 'too many open links(0)' error or 'Undefined service gds_db/tcp' error then
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:
add the following line to %SystemRoot%\system32\drivers\etc\services:
&lt;pre&gt;gds_db          3050/tcp                          #InterBase Server&lt;/pre&gt;
<pre>gds_db          3050/tcp                          #InterBase Server</pre>
You can create install_gds_db.php file in \udrive\home\admin\www:
You can create install_gds_db.php file in \udrive\home\admin\www:
&lt;pre&gt;&lt;?php
<pre><?php


// flag for gds_db port
// flag for gds_db port
$f_gds_db = false;
$f_gds_db = false;


$systemroot = getenv(&quot;SystemRoot&quot;);
$systemroot = getenv("SystemRoot");


$service_file = $systemroot.DIRECTORY_SEPARATOR.'system32'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR.'etc'.DIRECTORY_SEPARATOR.'services';
$service_file = $systemroot.DIRECTORY_SEPARATOR.'system32'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR.'etc'.DIRECTORY_SEPARATOR.'services';
Line 245: Line 244:
if (!$f_gds_db) {
if (!$f_gds_db) {
if ($fp = fopen($service_file, 'a')) {
if ($fp = fopen($service_file, 'a')) {
fwrite($fp, &quot;\r\ngds_db          3050/tcp                          #InterBase Server&quot;);
fwrite($fp, "\r\ngds_db          3050/tcp                          #InterBase Server");
fclose($fp);
fclose($fp);
echo &quot;&lt;script&gt;alert('gds_db port is sucessfully installed.\\nPlease restart the server!');&lt;/script&gt;\n&quot;;
echo "<script>alert('gds_db port is sucessfully installed.\\nPlease restart the server!');</script>\n";
}
}
else {
else {
echo &quot;&lt;script&gt;alert('failed to install gds_db port!\\nIf you want to use Firebird database you have to open gds_db port manually.\\nAdd the following line to services file:\\ngds_db\\t\\t3050/tcp\\t\\t#InterBase Server');&lt;/script&gt;\n&quot;;
echo "<script>alert('failed to install gds_db port!\\nIf you want to use Firebird database you have to open gds_db port manually.\\nAdd the following line to services file:\\ngds_db\\t\\t3050/tcp\\t\\t#InterBase Server');</script>\n";
}
}
}
}


?&gt;&lt;/pre&gt;
?></pre>




Put the following code somewhere in the \udrive\home\admin\www\index.php, then when you start the server if the gds_db port is not installed it will install automatically. This is good for portable server. Anywhere you go just start the server then everything is ok:
Put the following code somewhere in the \udrive\home\admin\www\index.php, then when you start the server if the gds_db port is not installed it will install automatically. This is good for portable server. Anywhere you go just start the server then everything is ok:


&lt;pre&gt;&lt;?
<pre><?
include &quot;install_gds_db.php&quot;;
include "install_gds_db.php";
?&gt;&lt;/pre&gt;
?></pre>





Revision as of 08:37, 24 November 2010

Introductions

The following method is a little changed from that which I explained in http://forum.uniformserver.com. You can see the previouse one clicking here.

Thanks to the policy of Firebird that it allows the server run as an application we can install firebird into Uniform Server. the key is adding "-a" after fbserver.exe command: fbserver.exe -a.

Firebird is open source and supports many options and syntaxes more than mysql. Still there are not many who use firebird as an web-based server. because of that I also had a hard time to use it. To many of us Mysql is a great option to use but it's not open source. I spent my time to install firebird to Uniform server and I just want to be a helper to them who want to use firebird as a portable database server.

The following shows how to install Firebird to your portable Uniform server.

Install Firebird Server

Visit http://www.firebirdsql.org and download the latest firebird no-install version and uncompress the zip to the uniform server\udrive\usr\local and change the newly created folder name to firebird. Here is the link for firebird v.2.1.0.17798.

Make a folder where you want to save firebird database files like: \udrive\var\firebird

Edit start_server.bat

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

Under that line write down and save:

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

Edit php.ini

Check that you have php_interbase.dll in your php extension folder. If you don't have you have to get it from http://www.php.net. You will need php_pdo_firebird.dll also if you want to use PDO.

Open php.ini and find extension option and uncomment extension=php_interbase.dll. If you want to use pdo then uncomment extension=php_pdo_firebird.dll also.

Add the following to php.ini:

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

The value is not given. set your own value if you want. Blank means default value will be used.

"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"

Edit Close.bat

Open \udrive\home\admin\program\Close.bat and find the line:

:nomysql

Add under:

%Disk%:\home\admin\program\pskill.exe fbserver.exe
IF ERRORLEVEL 1 goto nofirebird
%Disk%:\home\admin\program\pskill.exe fbserver.exe c
:nofirebird

Firebird tray icon will be shown so we can shutdown the server using tray icon but we want the database server to be shutdowned when we finish the Uniform server. So we use pskill to kill the process by force.

Install Web Admin tool

Download the ibWebAdmin from here and unzip to \udrive\home\admin\www

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/');

We already created \var\firebird folder for saving database!

define('DEFAULT_HOST',    'localhost');
define('DEFAULT_CACHE',   8192); 

for better caching. You can change that.

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

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

You need to create \var\firebird\backup for backup folder.

Edit Firebird configuration

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

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

TempDirectories = /tmp

DefaultDbCachePages = 8192

Edit Uniform Admin Panel Files

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

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

Add next:

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

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>

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>

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\"";
}

Add next:

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

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

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

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

    'nav-ibwa' => 'ibWebAdmin',

Create Files

Create rfirebird.cgi file in the \udrive\home\admin\www\cgi-bin\includes\lang\en:

#!/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";
}

Create sfirebird.cgi file in \udrive\home\admin\www\cgi-bin\includes\lang\en:

#!/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";
}

Copy DLL

Copy fbclient.dll from \udrive\usr\local\firebird\bin to \udrive\usr\local\php. and for compatibility copy another and change its name to gds32.dll. If you have already then replace it. If the version of dll and the server are different it will not work!

If you encounter errors like “Application failed to start gds32.dll not found” or similiar there are solutions for these. try some of following:

Copy fbclient.dll also to \udrive\usr\local\apache\bin and copy another and change its name to gds32.dll. If you still have problem to connect to the server then you probably have gds32.dll or fbclient.dll in your %WINDIR%system32 folder and the dll file is of a old version. replace it or if you don't have any applications that use the dll file then remove it.

GDS_DB Problem

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

You can create install_gds_db.php file in \udrive\home\admin\www:

<?php

// flag for gds_db port
$f_gds_db = false;

$systemroot = getenv("SystemRoot");

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

$lines = file($service_file);

foreach ($lines as $line) {
	if (strpos($line, 'gds_db') !== false) {
		$f_gds_db = true;
		break;
	}
}

if (!$f_gds_db) {
	if ($fp = fopen($service_file, 'a')) {
		fwrite($fp, "\r\ngds_db           3050/tcp                           #InterBase Server");
		fclose($fp);
		echo "<script>alert('gds_db port is sucessfully installed.\\nPlease restart the server!');</script>\n";
	}
	else {
		echo "<script>alert('failed to install gds_db port!\\nIf you want to use Firebird database you have to open gds_db port manually.\\nAdd the following line to services file:\\ngds_db\\t\\t3050/tcp\\t\\t#InterBase Server');</script>\n";
	}
}

?>


Put the following code somewhere in the \udrive\home\admin\www\index.php, then when you start the server if the gds_db port is not installed it will install automatically. This is good for portable server. Anywhere you go just start the server then everything is ok:

<?
include "install_gds_db.php";
?>


(I'm not an english speaking man. there will be typos and poor grammar. I would apreciate anybody who corrects them and add more information.)