PHP 4.x and Pervasive 7.x running on Linux.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
periko
Forum Newbie
Posts: 1
Joined: Thu Mar 27, 2008 6:20 pm

PHP 4.x and Pervasive 7.x running on Linux.

Post by periko »

Hi people.

I have 1 server running Pervasive 7.x in a Linux box, i can connect from windows clients using the ODBC stuff, but now i want to jump some applications to the web using PHP 4.x. We have the client that we install on each windows box, that install the necessary drivers.

The linux box is running Centos 4.6 + apache 2.0 + PHP 4.X, i want to use any standard browser(Firefox or IExplore) to connect my clients to my server, my clients can be windows xp or Linux Centos, Ubuntu or Fedora.

I already load UnixODBC + php-odbc, but what really don't understand is what i need to setup in my server to connect PHP with Pervasive
This is possible :?:

I have seen on other posts some examples, but went i run this script send errors:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>PHP Sample</TITLE>
</HEAD>
<BODY>
<?php
$conn=odbc_connect("Demodata","","","");
$sql="select * from class";
$rs=odbc_exec($conn,$sql);
echo "<table border=1>\n";
$numfields = odbc_num_fields($rs);
for($i=1;$i<=$numfields;$i++){
$fn=odbc_field_name($rs,$i);
echo "<th>$fn</th>";
}
echo "\n";
while(odbc_fetch_row($rs)){
echo "<tr>\n";
for($i=1;$i<=$numfields;$i++){
$fv=odbc_result($rs,$i);
echo "<td>$fv</td>";
}
echo "</tr>\n";
}
echo "</table>\n";
echo "<p>Number of Fields: $numfields</p>\n";
?>
</BODY>
</HTML>

PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /var/www/html/odbc.php on line 8
PHP Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in /var/www/html/odbc.php on line 10
<table border=1>
PHP Warning: odbc_num_fields(): supplied argument is not a valid ODBC result resource in /var/www/html/odbc.php on line 12

PHP Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in /var/www/html/odbc.php on line 18

I have read a lot of this here in this site, but i still don't answer my question, hope some could point me something, i will aprecciated, thanks all for your help. :D
Post Reply