FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Server Development

 
 
LinkBack Thread Tools
 
Old 04-26-2010, 03:51 PM
Jamie McDonald
 
Default mssql + PHP issue - URGENT.

Hello all,

I've just managed to convince the management to let us run Linux boxes as our new frontend webservers - they are ubuntu-server 9.10 boxes configured for fail over using heartbeat and DRBD.

Our database servers however have remained as Microsoft SQL 2008 servers.


The issue I am having is that with the testing of our webserver's I cannot seem to connect to an MS SQL 2008 Express db server, every time I get the error


"Warning: mssql_connect() [function.mssql-connect]:
Unable to connect to server: 192.168.1.15,1433 in /shared/var/www/oursite/inc/oursite_dbcon.php
on line 2

Could not connect to database: "

The PHP code used to connect is a standard connection string i.e.

"mssql_connect("192.168.1.15,1433","username","pas sw0rd") or die ("Could not connect to database: ".mssql_get_last_message());"


The web server has has 'apt-get install php5-sybase' run on it and apache restarted so the mssql.so object has been loaded - this is also confirmed by its presence on the output from phpinfo();.

I have disabled the firewall on the SQL2008 server - and can see the port 1433 listening on the test sql server (my workstation) from the webserver. I am also able to telnet to port 1433 on the SQL server from the webserver. The username and password are also correct - I have quadruple checked this.


I've been googling all afternoon and seem to be finding conflicting information regarding the ability of PHP to connect directly to an MSSQL database. Some sites seem to suggest you must use a DSN via an odbc connection but other sites suggest the old school connection string method should work fine just as you would if using mysql. I really don't want to start modfying the developers code, as far as I'm concerned this codebase worked fine under windows/iis so it should run in our new Linux environment.


If anyone can give me any clarification on this issue I would be very thankful as these servers are going to be racked this week and I do not want to have the powers that be decide we should revert to Windows Server / IIS.


Kind Regards,
Jamie.

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 04-26-2010, 04:38 PM
"Nikolai K. Bochev"
 
Default mssql + PHP issue - URGENT.

Can you try connecting with tsql ?
I have been able to connect ot mssql 2008 std edition just fine, no really sure, but i think express has some protocols either missing or disabled by default.
Also, you should add an entry in /etc/freetds/freetds.conf ( or the appropriate config ) and use that entry as a connection string.
I can check the details on how i made it work tomorrow, since i am too lazy to log to work pc right now :F

Hello all,

I've just managed to convince the management to let us run Linux boxes as our new frontend webservers - they are ubuntu-server 9.10 boxes configured for fail over using heartbeat and DRBD.

Our database servers however have remained as Microsoft SQL 2008 servers.


The issue I am having is that with the testing of our webserver's I cannot seem to connect to an MS SQL 2008 Express db server, every time I get the error


"Warning: mssql_connect() [function.mssql-connect]:
Unable to connect to server: 192.168.1.15,1433 in /shared/var/www/oursite/inc/oursite_dbcon.php
on line 2

Could not connect to database: "

The PHP code used to connect is a standard connection string i.e.

"mssql_connect("192.168.1.15,1433","username","pas sw0rd") or die ("Could not connect to database: ".mssql_get_last_message());"


The web server has has 'apt-get install php5-sybase' run on it and apache restarted so the mssql.so object has been loaded - this is also confirmed by its presence on the output from phpinfo();.

I have disabled the firewall on the SQL2008 server - and can see the port 1433 listening on the test sql server (my workstation) from the webserver. I am also able to telnet to port 1433 on the SQL server from the webserver. The username and password are also correct - I have quadruple checked this.


I've been googling all afternoon and seem to be finding conflicting information regarding the ability of PHP to connect directly to an MSSQL database. Some sites seem to suggest you must use a DSN via an odbc connection but other sites suggest the old school connection string method should work fine just as you would if using mysql. I really don't want to start modfying the developers code, as far as I'm concerned this codebase worked fine under windows/iis so it should run in our new Linux environment.


If anyone can give me any clarification on this issue I would be very thankful as these servers are going to be racked this week and I do not want to have the powers that be decide we should revert to Windows Server / IIS.


Kind Regards,
Jamie.


--

Nikolai K. Bochev
System Administrator



--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 04-26-2010, 06:06 PM
Soren Hansen
 
Default mssql + PHP issue - URGENT.

On Mon, Apr 26, 2010 at 04:51:47PM +0100, Jamie McDonald wrote:
> Our database servers however have remained as Microsoft SQL 2008
> servers.

There's a bunch of hints on the php.net page for mssql_connect.
Specifically, this may apply:

When you try to connect to SQL Server 2008 Express, you always have
to name the instance you are trying to connect to, even if you
installed SQL2008express as "Default" instance instead of named
instance. If your instance is SQLExpress and server name is
myServer, the server parameter must be: "myServerSQLExpress". If
you installed Default instance of Standard (not express) version of
SQL2008 instead, you don't need to name the instance. To connect
using TCP/IP, you need also to check server network configuration,
enable TCP/IP (listen all: yes), then go to addresses tab and setup
port 1433 in all addresses you want the server listen on (by
default, port is blank and server don't listen). Libraries involved
in TCP/IP are ntwdblib.dll and dbnetlib.dll. Have fun!

Source: http://www.php.net/manual/en/function.mssql-connect.php#96134

Another comment on that page says:

If your are trying to connect to a MSSQLServer 8 and got this error:
Unabled to connect to: [SERVER_NAME] and u r using Server
authentication, make sure 2 set up mssql.secure_connection to Off in
da php.ini

RCGP

Making this world better everyday... peace out

Source: http://www.php.net/manual/en/function.mssql-connect.php#85783

Apologies for the poor spelling in that last one. I'm not the original
author.

I've never used MS SQL myself, so it's hard for me to tell if the above
make sense for your case. If not, try looking through the comments on
that page for hints.

--
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/
--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 04-26-2010, 06:54 PM
Mark Foster
 
Default mssql + PHP issue - URGENT.

I'm almost positive you ALSO need the sybase client package(s)
installed. The php5-sybase is not a pure driver but a hook.



On 04/26/2010 08:51 AM, Jamie McDonald wrote:
Hello all,



I've just managed to convince the management to let us run Linux boxes
as our new frontend webservers - they are ubuntu-server 9.10 boxes
configured for fail over using heartbeat and DRBD.



Our database servers however have remained as Microsoft SQL 2008
servers.



The issue I am having is that with the testing of our webserver's I
cannot seem to connect to an MS SQL 2008 Express db server, every time
I get the error



"Warning: mssql_connect() [function.mssql-connect]:

Unable to connect to server: 192.168.1.15,1433 in /shared/var/www/oursite/inc/oursite_dbcon.php
on line 2

Could not connect to database: "



The PHP code used to connect is a standard connection string i.e.



"mssql_connect("192.168.1.15,1433","username","pas sw0rd") or die
("Could not connect to database: ".mssql_get_last_message());"



The web server has has 'apt-get install php5-sybase' run on it and
apache restarted so the mssql.so object has been loaded - this is also
confirmed by its presence on the output from phpinfo();.



I have disabled the firewall on the SQL2008 server - and can see the
port 1433 listening on the test sql server (my workstation) from the
webserver. I am also able to telnet to port 1433 on the SQL server from
the webserver. The username and password are also correct - I have
quadruple checked this.



I've been googling all afternoon and seem to be finding conflicting
information regarding the ability of PHP to connect directly to an
MSSQL database. Some sites seem to suggest you must use a DSN via an
odbc connection but other sites suggest the old school connection
string method should work fine just as you would if using mysql. I
really don't want to start modfying the developers code, as far as I'm
concerned this codebase worked fine under windows/iis so it should run
in our new Linux environment.



If anyone can give me any clarification on this issue I would be very
thankful as these servers are going to be racked this week and I do not
want to have the powers that be decide we should revert to Windows
Server / IIS.



Kind Regards,

Jamie.






--
I hate racists. Mark D. Foster <mark@foster.cc>
http://mark.foster.cc/ | http://www.freegeekseattle.org/




--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 
Old 04-27-2010, 09:26 AM
Jamie McDonald
 
Default mssql + PHP issue - URGENT.

Right,

Thanks to all of you for your research efforts, they give
me confidence - more importantly your quick responses have given the
management some confidence in running with an opensource product.

Regardless,
and this is slightly embarrassing but I feel I should be honest - the
issue was due to the supplying of a port number on the server string.
Odd that IIS and PHP on windows had no problem with it but regardless I
am now connected to the MSSQL server - without the use of an odbc
connection.


So for future reference, in order to connect to an MSSQL 2008
Express server via PHP from an Ubuntu-Server 9.10 machine you only
require the 'php5-sybase' package combined with the following connection
string.


"mssql_connect("192.168.1.15","username","passw0rd ") or die
("Could not connect to database: ".mssql_get_last_message());"

Do
not specify the port number within the mssl_connect server string i.e.
"mssql_connect("192.168.1.15,
1433","username","passw0rd") or die
("Could not connect to database: ".mssql_get_last_message());".


It's also worth noting that I did not have to specify the database
instance i.e. SQLEXPRESS despite what various sources on tha interweb
have stated.

Thanks again for your help
Kind Regards,
Jamie.

On Tue, Apr 27, 2010 at 10:25 AM, Jamie McDonald <jmack@iclebyte.com> wrote:

Right,

Thanks to all of you for your research efforts, they give me confidence - more importantly your quick responses have given the management some confidence in running with an opensource product.


Regardless, and this is slightly embarrassing but I feel I should be honest - the issue was due to the supplying of a port number on the server string. Odd that IIS and PHP on windows had no problem with it but regardless I am now connected to the MSSQL server - without the use of an odbc connection.



So for future reference, in order to connect to an MSSQL 2008 Express server via PHP from an Ubuntu-Server 9.10 machine you only require the 'php5-sybase' package combined with the following connection string.



"mssql_connect("192.168.1.15","username","passw0rd ") or die
("Could not connect to database: ".mssql_get_last_message());"

Do not specify the port number within the mssl_connect server string i.e. "mssql_connect("192.168.1.15,
1433","username","passw0rd") or die
("Could not connect to database: ".mssql_get_last_message());".

It's also worth noting that I did not have to specify the database
instance i.e. SQLEXPRESS despite what various sources on tha interweb
have stated.

Thanks again for your help
Kind Regards,
Jamie.


On Mon, Apr 26, 2010 at 7:54 PM, Mark Foster <mark@foster.cc> wrote:








I'm almost positive you ALSO need the sybase client package(s)
installed. The php5-sybase is not a pure driver but a hook.



On 04/26/2010 08:51 AM, Jamie McDonald wrote:
Hello all,



I've just managed to convince the management to let us run Linux boxes
as our new frontend webservers - they are ubuntu-server 9.10 boxes
configured for fail over using heartbeat and DRBD.



Our database servers however have remained as Microsoft SQL 2008
servers.



The issue I am having is that with the testing of our webserver's I
cannot seem to connect to an MS SQL 2008 Express db server, every time
I get the error



"Warning: mssql_connect() [function.mssql-connect]:

Unable to connect to server: 192.168.1.15,1433 in /shared/var/www/oursite/inc/oursite_dbcon.php
on line 2

Could not connect to database: "



The PHP code used to connect is a standard connection string i.e.



"mssql_connect("192.168.1.15,1433","username","pas sw0rd") or die
("Could not connect to database: ".mssql_get_last_message());"



The web server has has 'apt-get install php5-sybase' run on it and
apache restarted so the mssql.so object has been loaded - this is also
confirmed by its presence on the output from phpinfo();.



I have disabled the firewall on the SQL2008 server - and can see the
port 1433 listening on the test sql server (my workstation) from the
webserver. I am also able to telnet to port 1433 on the SQL server from
the webserver. The username and password are also correct - I have
quadruple checked this.



I've been googling all afternoon and seem to be finding conflicting
information regarding the ability of PHP to connect directly to an
MSSQL database. Some sites seem to suggest you must use a DSN via an
odbc connection but other sites suggest the old school connection
string method should work fine just as you would if using mysql. I
really don't want to start modfying the developers code, as far as I'm
concerned this codebase worked fine under windows/iis so it should run
in our new Linux environment.



If anyone can give me any clarification on this issue I would be very
thankful as these servers are going to be racked this week and I do not
want to have the powers that be decide we should revert to Windows
Server / IIS.



Kind Regards,

Jamie.






--
I hate racists. Mark D. Foster <mark@foster.cc>
http://mark.foster.cc/ | http://www.freegeekseattle.org/





--

ubuntu-server mailing list

ubuntu-server@lists.ubuntu.com

https://lists.ubuntu.com/mailman/listinfo/ubuntu-server

More info: https://wiki.ubuntu.com/ServerTeam




--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam
 

Thread Tools




All times are GMT. The time now is 09:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org