Installing Firebird: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
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 9: Line 10:


== 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:&lt;pre&gt;start \usr\local\mysql\bin\mysqld-opt.exe --defaults-file=/usr/local/mysql/bin/my-small.cnf&lt;/pre&gt;


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


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


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


== 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:
<pre>:nomysql</pre>
&lt;pre&gt;:nomysql&lt;/pre&gt;
Add under:
Add under:
<pre>%Disk%:\home\admin\program\pskill.exe fbserver.exe
&lt;pre&gt;%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</pre>
:nofirebird&lt;/pre&gt;


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 53: Line 54:


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


$ALLOWED_DIRS = array('/var/firebird/',
$ALLOWED_DIRS = array('/var/firebird/',
                       '/tmp/');</pre>
                       '/tmp/');&lt;/pre&gt;
<pre>define('BACKUP_DIR', '/var/firebird/backup/'); </pre>
&lt;pre&gt;define('BACKUP_DIR', '/var/firebird/backup/'); &lt;/pre&gt;
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:
<pre>RootDirectory = \usr\local\firebird</pre>
&lt;pre&gt;RootDirectory = \usr\local\firebird&lt;/pre&gt;
<pre>DatabaseAccess = Restrict W:\usr\local\firebird;W:\var\firebird;W:\var\firebird\backup</pre>
&lt;pre&gt;DatabaseAccess = Restrict W:\usr\local\firebird;W:\var\firebird;W:\var\firebird\backup&lt;/pre&gt;
Be careful when you define the DatabaseAccess, it should have the drive letter "W:", otherwise the firebird gives you error.
Be careful when you define the DatabaseAccess, it should have the drive letter &quot;W:&quot;, otherwise the firebird gives you error.
<pre>TempDirectories = /tmp
&lt;pre&gt;TempDirectories = /tmp


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


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


if ($res == 0){
if ($res == 0){
       system "/home/admin/program/pskill.exe fbserver.exe c";
       system &quot;/home/admin/program/pskill.exe fbserver.exe c&quot;;
}</pre>
}&lt;/pre&gt;
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:
<pre>   'nav-rfirebird' => 'Run Firebird',
&lt;pre&gt;   'nav-rfirebird' =&gt; 'Run Firebird',
     'nav-sfirebird' => 'Stop Firebird',
     'nav-sfirebird' =&gt; 'Stop Firebird',


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


== 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:
<pre>#!/usr/bin/perl
&lt;pre&gt;#!/usr/bin/perl


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


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


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


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


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


Line 150: Line 151:


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


sub start_Firebird(){
sub start_Firebird(){
     exec "/usr/local/firebird/bin/fbserver.exe -a";
     exec &quot;/usr/local/firebird/bin/fbserver.exe -a&quot;;
}</pre>
}&lt;/pre&gt;
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:
<pre>#!/usr/bin/perl
&lt;pre&gt;#!/usr/bin/perl


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


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


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


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


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


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


Line 203: Line 204:


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


== Copy DLL ==
== Copy DLL ==
Line 222: Line 223:
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:
<pre>gds_db          3050/tcp                          #InterBase Server</pre>
&lt;pre&gt;gds_db          3050/tcp                          #InterBase Server&lt;/pre&gt;
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:
<pre><?php
&lt;pre&gt;&lt;?php


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


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


$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 244: Line 245:
if (!$f_gds_db) {
if (!$f_gds_db) {
if ($fp = fopen($service_file, 'a')) {
if ($fp = fopen($service_file, 'a')) {
fwrite($fp, "\r\ngds_db          3050/tcp                          #InterBase Server");
fwrite($fp, &quot;\r\ngds_db          3050/tcp                          #InterBase Server&quot;);
fclose($fp);
fclose($fp);
echo "<script>alert('gds_db port is sucessfully installed.\\nPlease restart the server!');</script>\n";
echo &quot;&lt;script&gt;alert('gds_db port is sucessfully installed.\\nPlease restart the server!');&lt;/script&gt;\n&quot;;
}
}
else {
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";
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;;
}
}
}
}


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




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:


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





Revision as of 01:01, 24 November 2010

Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page

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:<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: <pre>start \usr\local\firebird\bin\fbserver.exe -a</pre>

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:<pre><nowiki>[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 =</nowiki></pre>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: <pre>:nomysql</pre> Add under: <pre>%Disk%:\home\admin\program\pskill.exe fbserver.exe IF ERRORLEVEL 1 goto nofirebird %Disk%:\home\admin\program\pskill.exe fbserver.exe c

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.

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: <pre>define('BINPATH', '/usr/local/firebird/bin/'); define('SECURITY_DB', '/usr/local/firebird/security2.fdb'); define('TMPPATH', '/tmp/');</pre> <pre>define('DEFAULT_PATH', '/var/firebird/');</pre> We already created \var\firebird folder for saving database! <pre>define('DEFAULT_HOST', 'localhost');</pre> <pre>define('DEFAULT_CACHE', 8192); </pre> for better caching. You can change that. <pre>define('DEFAULT_SERVER', 'FB_2.0');

$ALLOWED_DIRS = array('/var/firebird/',

                     '/tmp/');</pre>

<pre>define('BACKUP_DIR', '/var/firebird/backup/'); </pre> 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: <pre>RootDirectory = \usr\local\firebird</pre> <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 "W:", otherwise the firebird gives you error. <pre>TempDirectories = /tmp

DefaultDbCachePages = 8192</pre>

Edit Uniform Admin Panel Files

Open \udrive\home\admin\www\includes\tool.inc and find line: <pre><a target="_phpmyadmin" onclick="h(this);" href="<?=$apanel?>/phpMyAdmin/"><?=$US['nav-pma']?></a></pre> Add next: <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: <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: <pre><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></pre> Open \udrive\home\admin\www\cgi-bin\includes\lang\en\sserver.cgi and find: <pre> system "/home/admin/program/uniserv.exe \"\\usr\\local\\mysql\\bin\\mysqladmin.exe --user=root --password=$password shutdown\""; }</pre> Add next: <pre>$res = system "\\home\\admin\\program\\pskill.exe", "fbserver.exe";

if ($res == 0){

     system "/home/admin/program/pskill.exe fbserver.exe c";

}</pre> Open \udrive\home\admin\www\includes\lang\en.php add in the code: <pre> 'nav-rfirebird' => 'Run Firebird',

   'nav-sfirebird' => 'Stop Firebird',
   'nav-ibwa' => 'ibWebAdmin',</pre>

Create Files

Create rfirebird.cgi file in the \udrive\home\admin\www\cgi-bin\includes\lang\en: <pre>#!/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";

}</pre> Create sfirebird.cgi file in \udrive\home\admin\www\cgi-bin\includes\lang\en: <pre>#!/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";

}</pre>

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: <pre>gds_db 3050/tcp #InterBase Server</pre> You can create install_gds_db.php file in \udrive\home\admin\www: <pre><?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"; } }

?></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:

<pre><? include "install_gds_db.php"; ?></pre>


(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.)