[PHP] php/osx and firebird

2005-06-15 Thread James

I have a windows machine with Firebird and the default database.



I've configured another machine with Apache and PHP.  I want to write 
PHP scripts to remotely access the Firebird database.



I followed the instructions at:
http://us3.php.net/ibase


I changed the php.ini to enable the php_interbase.dll and the 
php_gd2.dll by commenting out the two lines under Windows Extensions


I also copied gds32.dll from the php directory to the 
C:\windows\system32 directory.


I restarted Apache.


This is in my PHP script:

$host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb;
$username = SYSDBA;   
$password = masterkey;

$dbh = ibase_pconnect ($host, $username, $password);
$stmt = SELECT * FROM EVENTTYP;
$sth = ibase_query ($dbh, $stmt);


I get the following error:

Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to 
complete network request to host 10.1.4.58. Failed to locate host 
machine. Undefined service gds_db/tcp. in 
d:\htdocs\Website\PHP\dtest.php on line 17


Warning: ibase_query() [function.ibase-query]: invalid database 
handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on 
line 20






I was able to use isql to remotely connect using the parameters above.


What am I not doing on the PHP end to get this to work?

--
-James


Re: [PHP] php/osx and firebird

2005-06-15 Thread Kristen G. Thorson

Undefined service gds_db/tcp.

Sounds to me like it's not finding the port in services.  I don't know 
what default port Firebird is listening on, but you should have an entry 
like


gds_db/tcp 1234/tcp

in c:\windows\system32\drivers\etc\services.  You'll have to find out 
exactly which port it's listening on.  I think you may need this on both 
the client and the server.



kgt





James wrote:


I have a windows machine with Firebird and the default database.



I've configured another machine with Apache and PHP.  I want to write 
PHP scripts to remotely access the Firebird database.



I followed the instructions at:
http://us3.php.net/ibase


I changed the php.ini to enable the php_interbase.dll and the 
php_gd2.dll by commenting out the two lines under Windows Extensions


I also copied gds32.dll from the php directory to the 
C:\windows\system32 directory.


I restarted Apache.


This is in my PHP script:

$host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb;
$username = SYSDBA;   $password = masterkey;
$dbh = ibase_pconnect ($host, $username, $password);
$stmt = SELECT * FROM EVENTTYP;
$sth = ibase_query ($dbh, $stmt);


I get the following error:

Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to 
complete network request to host 10.1.4.58. Failed to locate host 
machine. Undefined service gds_db/tcp. in 
d:\htdocs\Website\PHP\dtest.php on line 17


Warning: ibase_query() [function.ibase-query]: invalid database handle 
(no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20






I was able to use isql to remotely connect using the parameters above.


What am I not doing on the PHP end to get this to work?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php/osx and firebird

2005-06-15 Thread James


Here's the answer!
http://community.borland.com/article/0,1410,25290,00.html

I updated the SERVICE file on my Apache/PHP machine and all is well.


At 12:04 PM -0400 6/15/05, James wrote:

I have a windows machine with Firebird and the default database.



I've configured another machine with Apache and PHP.  I want to 
write PHP scripts to remotely access the Firebird database.



I followed the instructions at:
http://us3.php.net/ibase


I changed the php.ini to enable the php_interbase.dll and the 
php_gd2.dll by commenting out the two lines under Windows Extensions


I also copied gds32.dll from the php directory to the 
C:\windows\system32 directory.


I restarted Apache.


This is in my PHP script:

$host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb;
$username = SYSDBA;  
$password = masterkey;

$dbh = ibase_pconnect ($host, $username, $password);
$stmt = SELECT * FROM EVENTTYP;
$sth = ibase_query ($dbh, $stmt);


I get the following error:

Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to 
complete network request to host 10.1.4.58. Failed to locate host 
machine. Undefined service gds_db/tcp. in 
d:\htdocs\Website\PHP\dtest.php on line 17


Warning: ibase_query() [function.ibase-query]: invalid database 
handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on 
line 20






I was able to use isql to remotely connect using the parameters above.


What am I not doing on the PHP end to get this to work?

--
-James



--
-James


Re: [PHP] php/osx and firebird

2005-06-15 Thread Richard Lynch
On Wed, June 15, 2005 9:04 am, James said:
 $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb;
 $username = SYSDBA;
 $password = masterkey;
 $dbh = ibase_pconnect ($host, $username, $password);
 $stmt = SELECT * FROM EVENTTYP;
 $sth = ibase_query ($dbh, $stmt);

 Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to
 complete network request to host 10.1.4.58. Failed to locate host
 machine. Undefined service gds_db/tcp. in
 d:\htdocs\Website\PHP\dtest.php on line 17

I don't know diddly-squat about this Firebird ibase stuff, but this sounds
to me like a network error message that your PHP machine can't get to the
Firebird machine.

Start at the lowest level.

Can you ping 10.1.4.58 from your PHP box?  It might be
configured/firewalled to not let you do ping so it's not REQUIRED that
ping work for your PHP script to work, but it's at least a start.

 Warning: ibase_query() [function.ibase-query]: invalid database
 handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on
 line 20

Ignore this for now -- It's a direct result of the first error.

 I was able to use isql to remotely connect using the parameters above.

Wow.  Okay, that's way better than my ping test above...

Still, double check that this still works, just to be SURE.

 What am I not doing on the PHP end to get this to work?

PHP runs as the user defined by User directive in httpd.conf

Odds are really good your isql remote test was run by you logged in as,
errr, whatever Windows logs you in as, or whatever you log in as, if
you're on a Windows box that has logins, or... Well, anyway, it almost for
sure is not the same User as you have set in httpd.conf

In the ideal world, you'd know how to log into your Windows box as the PHP
User -- If you *DO* log in to your Windows box, then do this.

If not, JUST FOR TESTING, you could change the User setting in httpd.conf
to be, like, Administrator or whatever the Windoze root user is called
this week.

Restart Apache, and test.

If that works, you have narrowed it down to a permissions problem.  God
only knows how you fix that under Windows, but it's the most likely source
of your problem.

The thing you *DO* *NOT* want to do, no matter what, is leave Apache
running as Administrator!  Change it back immediately after your test.

If you have to choose between running PHP as Admin, and getting fired
because you can't make this work, start looking for a new job.  It's that
important.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php/osx and firebird

2005-05-06 Thread Jochem Maas
James wrote:
I've attempted to access a firebird database living on an osx/apache/php 
machine.

When I'm running the following script,
?php
ini_set(magic_quotes_sybase, On);
$host = 
'localhost:/Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb'; 
for portability and ease of use I recommend using aliases with firebird. 
firebird
has a file named aliases.conf which should contain the following line:
exampledb = 
/Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb
once you have restarted firebird you can write the host var like so:
$host = 'localhost:exampledb';
$username = sysdba;
$password = masterkey;

$dbh = ibase_connect($host, $username, $password);
if (!($dbh=ibase_connect($host, 'sysdba', 'yourpass', 'ISO8859_1', 
0, 1)))
  die('Could not connect: ' .  ibase_errmsg());

$stmt = 'SELECT * FROM employee';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
 echo $row-full_name, \n;
}
ibase_free_result($sth);
ibase_close($dbh);
  ?
I get the following error:
Call to undefined function ibase_connect()
How do I enable those functions?  I've looked at the php documentation 
(http://uk2.php.net/manual/en/ref.ibase.php )

To enable InterBase support configure PHP --with-interbase[=DIR], where 
DIR is the InterBase base install directory, which defaults to 
/usr/interbase.
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.

oh dear you are lost (no offence, I know the feeling!).
configuring in this instance means configuring the 'build' before you
compile php this may not even be necessary in your
case (if you have the interbase extension already built)
at any rate there should not be anything like '--with-interbase=' in
your php.ini!
instead you will need a line that goes something like:
extension=php_interbase.dll (windows)
only in your case the extension will be called something like
php_interbase.so
php_ibase.so
php_ibase.dylib (I guess, could be wrong)
Am I pointing to the wrong directory?  What other configuration/setup do 
I have to do to enable php's interbase functions?
you need to have a binary of the php interbase extension suitable for your
php build AND you need to load the extension
Thanks.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php/osx and firebird

2005-05-05 Thread James
I've attempted to access a firebird database living on an 
osx/apache/php machine.

When I'm running the following script,
?php
ini_set(magic_quotes_sybase, On);
	$host = 
'localhost:/Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb';
	$username = sysdba;
	$password = masterkey;


$dbh = ibase_connect($host, $username, $password);
	if (!($dbh=ibase_connect($host, 'sysdba', 'yourpass', 
'ISO8859_1', 0, 1)))
  		die('Could not connect: ' .  ibase_errmsg());

	$stmt = 'SELECT * FROM employee';
	$sth = ibase_query($dbh, $stmt);
	while ($row = ibase_fetch_object($sth)) {
	 echo $row-full_name, \n;
	}
	ibase_free_result($sth);
	ibase_close($dbh);
	  
?

I get the following error:
Call to undefined function ibase_connect()
How do I enable those functions?  I've looked at the php 
documentation (http://uk2.php.net/manual/en/ref.ibase.php )

To enable InterBase support configure PHP --with-interbase[=DIR], 
where DIR is the InterBase base install directory, which defaults to 
/usr/interbase.
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.

Am I pointing to the wrong directory?  What other configuration/setup 
do I have to do to enable php's interbase functions?

Thanks.
--
-James

Re: [PHP] php/osx and firebird

2005-05-05 Thread Gabriel Guzman
James wrote:
I've attempted to access a firebird database living on an osx/apache/php 
machine.
snip
How do I enable those functions?  I've looked at the php documentation 
(http://uk2.php.net/manual/en/ref.ibase.php )

To enable InterBase support configure PHP --with-interbase[=DIR], where 
DIR is the InterBase base install directory, which defaults to 
/usr/interbase.
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.
James... this is talking about configuring the php compile, not a 
setting in php.ini

so, for example if you just downloaded php-4.3.11.tar.bz2 from the 
php.net website, and un zip/tarred it, you would run the configure script:

./configure --with-interbase[=DIR] (plus any other compile time options 
you need)

then compile and install php (make, make install)
Am I pointing to the wrong directory?  What other configuration/setup do 
I have to do to enable php's interbase functions?
this is a compile time option, and not a php.ini one.
hth,
gabe.
p.s. you can see what current compile time options are by looking at the 
output of phpinfo()

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php/osx and firebird

2005-05-05 Thread Lester Caine
James wrote:
To enable InterBase support configure PHP --with-interbase[=DIR], where 
DIR is the InterBase base install directory, which defaults to 
/usr/interbase.
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.
That does not sound like a program directory.
Check the Firebird installation guide - /opt/firebird is the most likely 
location, but does depend on which version of Linux and how it was 
installed.

Am I pointing to the wrong directory?  What other configuration/setup do 
I have to do to enable php's interbase functions?
Once you have installed with the right directory, phpinfo() will show 
the module details.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php