portsnap fetch update
cd /usr/ports/lang/php5-extensions/
make config
make install clean
cd /usr/ports/databases/php5-mssql
make install clean
pkg_add -r -v php5-mssql
<?php
$myServer = "10.x.x.x";
$myUser = "username";
$myPass = "password";
$myDB = "master";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT id, info, status ";
$query .= "FROM sysobjects ";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["id"] . $row["info"] . $row["status"] . "</li>";
}
//close the connection
mssql_close($dbhandle);
?>
Couldn't connect to SQL Server on 10.x.x.x
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[PHP Modules]
calendar
ctype
curl
date
dom
filter
ftp
hash
iconv
imap
json
libxml
mssql
mysql
odbc
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zip
[Zend Modules]
06/15/2009 12:42:53,Logon,Unknown,The login packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library. [CLIENT: 10.x.x.x]
06/15/2009 12:09:56,Logon,Unknown,Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library. [CLIENT: 10.x.x.x]
roddierod said:Is there anything between the FreeBSD and SQL server that isn't present in the Linux machine route?
ph0enix said:Are we talking about the IP routing table? If so, I'm able to telnet into port 1433 on the SQL server from both, the Linux and the FreeBSD systems.
[PHP Modules]
ADOdb
calendar
ctype
curl
date
dom
filter
ftp
hash
iconv
imap
json
libxml
mssql
mysql
odbc
openssl
pcre
PDO
pdo_sqlite
posix
Reflection
session
SimpleXML
soap
SPL
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zip
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
$DB = NewADOConnection('mssql');
$DB->Connect('10.x.x.x', 'username','password', 'master');
# M'soft style data retrieval with binds
$rs = $DB->Execute("select * from sysobjects",array($key));
while (!$rs->EOF) {
print_r($rs->fields);
$rs->MoveNext();
}
?>
Fatal error: Call to undefined function NewADOConnection() in /usr/home/jacks/adodb.php on line 4
Warning: require_once(adodb/adodb-exceptions.inc.php): failed to open stream: No such file or directory in /current/path/adodb.php on line 4
Fatal error: require_once(): Failed opening required 'adodb/adodb-exceptions.inc.php' (include_path='.:/usr/local/share/pear') in /current/path/adodb.php on line 4
roddierod said:You have to set you include path in php.ini to include the directory that contains adodb directory, otherwise you have to use the full path in the require_once().
roddierod said:I double checked my install. I have /usr/local/share/adodb.
It looks as if that comes from the adodb-4.99.1 port. It's been a good while since I installed all this. I've been using the adodb with php for 5 or 6 years.
roddierod said:/usr/local/lib/php/20060613 is where it is located on my system. That is where all my php extensions are
extension=adodb.so
roddierod said:If you look at the example of the sourceforge page link you posted the first line is:
include('adodb/adodb.inc.php');
The test-adodb.php that is in the php-adodb-ext source package also contains such a line. Take a look at that example as the adodb.so calls have a slightly different syntax.
<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);
require_once('/usr/local/share/adodb/adodb-exceptions.inc.php');
require_once('/usr/local/share/adodb/adodb.inc.php');
$DB = NewADOConnection('mssql');
$DB->Connect('10.x.x.x', 'username','password', 'master');
# M'soft style data retrieval with binds
$rs = $DB->Execute("select * from sysobjects",array($key));
while (!$rs->EOF) {
print_r($rs->fields);
$rs->MoveNext();
}
?>
Warning: mssql_connect(): Unable to connect to server: 10.x.x.x in /usr/local/share/adodb/drivers/adodb-mssql.inc.php on line 520
Fatal error: Uncaught exception 'ADODB_Exception' with message 'mssql error: [: Connection error to server '10.x.x.x' with user 'username'] in CONNECT(10.x.x.x, 'username', '****', master)
' in /usr/local/share/adodb/adodb-exceptions.inc.php:78
Stack trace:
#0 /usr/local/share/adodb/adodb.inc.php(535): adodb_throw('mssql', 'CONNECT', false, 'Connection erro...', '10.x.x.x', 'master', Object(ADODB_mssql))
#1 /usr/home/jacks/ado4.php(7): ADOConnection->Connect('10.x.x.x', 'username', 'password', 'master')
#2 {main} thrown in /usr/local/share/adodb/adodb-exceptions.inc.php on line 78
[sql_server]
host = 10.x.x.x
port = 1433
tds version = 8.0