Hello,
I am trying to connect to a Microsoft SQL Server with an Apache+PHP but
always get an error.
This are the packages on my system (OpenBSD 3.7). Only this 3 packages
(it's a new box)
freetds-0.62.4p0 project to document and implement the TDS protocol
libiconv-1.9.2 character set conversion library
libxml-2.6.16p0 XML parsing library
I have download PHP 5.1.2 and compile with this commands:
# cd /tmp
# ftp <url_to_php/php-5.1.2.tar.gz>
# tar -xvzf php-5.1.2.tar.gz
# ./configure --with-apxs=/usr/sbin/apxs --with-mssql
# make
# make install
# vi /var/www/conf/httpd.conf
I add:
LoadModule php5_module /usr/lib/apache/modules/libphp5.so
AddType application/x-httpd-php .php
# apachectl start
put phpinfo.php file in /var/www/htdocs/ this is the result of mssql
section:
mssql
MSSQL Support
enabled
Active Persistent Links
0
Active Links
0
Library version
FreeTDS
Directive
Local Value
Master Value
mssql.allow_persistent
On
On
mssql.batchsize
0
0
mssql.charset
no value
no value
mssql.compatability_mode
Off
Off
mssql.connect_timeout
5
5
mssql.datetimeconvert
On
On
mssql.max_links
Unlimited
Unlimited
mssql.max_persistent
Unlimited
Unlimited
mssql.max_procs
Unlimited
Unlimited
mssql.min_error_severity
10
10
mssql.min_message_severity
10
10
mssql.secure_connection
Off
Off
mssql.textlimit
Server default
Server default
mssql.textsize
Server default
Server default
mssql.timeout
60
60
but when I try to connect to the SQL server with a simple command
<?
$conectID = mssql_connect("192.168.81.52:1433","user","password");
?>
the response is:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to
server: 192.168.81.52:1433 in /htdocs/index2.php on line 2
Ping and telnet works fine.
# ping 192.168.81.52
# telnet 192.168.81.52 1433.
Also I can connect executing '# tsql -H 192.168.81.52 -p 1433 -U user'
But from the script PHP it doesn't work.
Apache is chrooted (by default in OBSD). But if I download Apache and
compile Apache2, then compile PHP (and leave Apache not chrooted) the
script works fine...
My question: I have to do something with chroot and FreeTDS? (I don't
know what to do). Or this is a known problem of Apache 1.3.29? (I don't
find anything in google about a problem) and Apache can't be chrooted?
Thanks in advance.
Helio.