If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Just wanna connect PHP to Informix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-27-04, 16:52
DR4296 DR4296 is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Just wanna connect PHP to Informix

Greetings All !

I'm trying to set things up so that PHP on a Linux box I have access to will be able to make calls to a remote Informix database.

I don't have much experience installing software on Linux. The box isn't really mine. It's a box at my day-job that I've been given SysAdmin rights to. It's one Linux box among a great many Windows boxes. We've got one educational app running on it so far.

So, I did a lot of googling and it appeared to me that I needed to install the Informix SDK on the box. I did this. I then recompiled Apache and PHP... so that PHP now has its Informix module installed.

At this point, I'm now tackling altering the /etc/hosts, /etc/services, and $INFORMIXDIR/etc/sqlhosts files to match what I THINK they should be set to... based on some parameters given to me by the people here who connect to that Informix box over Windows.

One thing that disturbs me is that I saw some info suggesting I had to alter an /opt/informix/onconfig file. I do not have such a file out there.

Do I have to install the actual Informix Database Server on this box, even if I have no intention of ever using / needing such a database on this box... and I just want to connect to a REMOTE Informix database?

I guess I'll start off with that as my question and add more as they come up. Trying to do this all between my usual tasks at my day-job.


Thanks!

-= Dave =-
Reply With Quote
  #2 (permalink)  
Old 02-28-04, 09:49
DR4296 DR4296 is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Any idea where I'm screwing up here / why I can't connect ?

OK, figured I'd post as much info as possible. Here are my settings:

/ect/profile sets the following variables:


INFORMIXDIR="/opt/informix"
INFORMIXSERVER="odbc_net"
PATH="$PATH:$INFORMIXDIR:$INFORMIXDIR/bin"
(it exports them later in the file)


/etc/services ends with:
odbc_net 1526/tcp #Informix


http.conf ends with:
PassEnv INFORMIXDIR
PassEnv INFORMIXSERVER


sqlhosts file shows:
online onsoctcp ACD_DB odbc_net


ACD_DB has been set up properly in the /etc/hosts file

xinetd has been cycled, as has Apache


script (with correct username and password removed here for security reasons -- grin! ):

if (!($db = ifx_connect("odba_views@online","<username>", "<password>")))
{
print("Failed to connect to database!<BR>\n");
print("Aborting!<BR>");
exit();
};


Script fails with:

Warning: ifx_connect : E [SQLSTATE=IX 000 SQLCODE=-25596] in /usr/local/apache/htdocs/abandon/work.php on line 13
Failed to connect to database!
Aborting!


I can telnet to the Hostname and port. I got the port number from a Windows-based doc that was sent to me by someone who is somewhat familiar with the Informix side of things (in a more executive than technical role).

I'm kind of stuck at this point.


Thanks!

-= Dave =-
Reply With Quote
  #3 (permalink)  
Old 02-28-04, 10:35
DR4296 DR4296 is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Got it !

Got it!

INFORMIXSERVER = "online"

Thought I'd corrected that earlier.


I'm able to connect now. Linux box running Apache and PHP, with PHP compiled for Informix... plus the Informix Client SDK.

That's all the components I needed.


Thanks!

-= Dave =-
Reply With Quote
  #4 (permalink)  
Old 05-16-11, 13:11
martijm martijm is offline
Registered User
 
Join Date: May 2011
Posts: 1
Red face I need some help informix with php

hi , i try to connect informix with php
i work in windows, the informix server is on other

i register enviroment_variable

serverinformix = 192.168.1.2 (for example only)


i have to ext php_ifx.dll enable (default informix extention on wamp)

my script is


1: <?php
2: $id_con = ifx_connect ("server", "user", "pass");
3: ?>



i have this error:

Warning: ifx_connect() [function.ifx-connect]: E [SQLSTATE=IX 000 SQLCODE=-25596] in C:\wamp\www\ifx\ifx_connect.php on line 2




please i need some help



thanks
Reply With Quote
  #5 (permalink)  
Old 05-17-11, 10:34
marymurny marymurny is offline
Registered User
 
Join Date: Sep 2004
Posts: 32
Thumbs up Just wanna connect PHP to Informix

The 25596 error will occur when the INFORMIXSERVER is not in the sqlhosts files. Under windows that is controlled by the windows registry and SETNET32 program installed with ClientSDK.

If you open the sqlhosts file on the machine running Informix server there should be an entry such as:

ids11 onsoctcp linux11 ids11

if the last entry has a name you will need to look up what port it is running on in the /etc/services.

You can test the connection with Ilogin Demo program.

I hope this helps.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On