Jump to content

Archived

This topic is now archived and is closed to further replies.

olie480

1and1.com, php mssql disabled, workaround?

Recommended Posts

Hey everyone.

 

I was wondering if anyone had a situation where their server provider disabled the PHP MSSQL module, and will not enable it for you, and your code is strictly PHP based.

 

That is the situation I have with 1and1.com hosting. Our server in house is MSSQL, and I am trying to figure out how I can search it using PHP combined with Java, or any other technology through our website to our office database.

 

My last resort would be ditching my PHP knowledge and trying to learn ASP.NET and get my server switched over from Linux to Windows, but I think there has to be a better way.

 

Anyone have any solutions?

 

Thanks!

Share this post


Link to post
Share on other sites
My last resort would be ditching my PHP knowledge and trying to learn ASP.NET and get my server switched over from Linux to Windows, but I think there has to be a better way.

 

Switch hosting provider?

Share this post


Link to post
Share on other sites

The lower-level drivers for MSSQL do not exist on linux since they were made by Microsoft (kind of simplifying it, but oh well).  Things can be used in their place though, such as freetds (there are issues with using MSSQL with FreeTDS, but most people wouldn't come across the problems).

 

 

 

But, 1and1 would have to compile the php_mssql SO manually after compiling FreeTDS.

Share this post


Link to post
Share on other sites

I have php-mssql module installed on our 1and1.com dedicated server and this works a treat when connecting to our local MSSQL in house server.

 

I have recently changed hosting provider and installed the same module (need to install FREEtds too) but now I'm having trouble connecting when its exactly the same script.

 

Any ideas? All firewall rules are open

Share this post


Link to post
Share on other sites

Whoa I remember this thread.

 

 

 

Uhhh....  What error do you get?

Share this post


Link to post
Share on other sites

Thing is... I'm not getting any error messages. I have checked our MSSQL database and its giving an error:

 

17832 - Connection open but invalid login packets sent.

 

I know the user/pass is correct as I'm running the same script on another server which is connecting without a problem.

 

This only shows the echoed "Error:" and no actual error message
$new = mssql_connect("[ip]:1433", "[username]", "[password]");
if($new){ echo 'connected'; }
else{ 
echo 'Error: ';
echo  mssql_get_last_message(); }

 

Any help would be appreciated.

 

Many thanks

Share this post


Link to post
Share on other sites

Try "ip,1433".

 

I know.  It sounds weird, but I can remember having to use , instead of : before.

 

 

 

 

Invalid login packets.....  Hrmmm....  Sounds like an issue with client library revisions maybe.

Share this post


Link to post
Share on other sites

Thanks for the reply.

 

Changing from : to , did not make any difference. Surely I should be seeing error messages in php?

 

Starting to pull my hair out now! I will check with our IT Dept in regards to the client libraries.

 

If you have any other info please let me know.

 

Thanks again

Share this post


Link to post
Share on other sites

putenv('TDSVER=70');

I put the above code just before the connect statement and now it works. TDS versions on the server are set  to 7.0 so not sure why PHP needs this line of code in order to make the connection?

 

Many thanks

Share this post


Link to post
Share on other sites

Weird....  Not sure why that did it at all.

 

 

Is the server a linux server?  Perhaps that affects FreeTDS.

Share this post


Link to post
Share on other sites

Yes Redhat 5 methinks with FreeTDS and php-mssql module installed.

 

Its working and seems stable at the moment so I'm not fussed. Just didn't understand why the line of code makes it work even though the versions are set to the same on the server.

 

Many thanks

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.