0

How do I connect to a SQL Server with SSL from PHP?

Edit I should be more elaborate on this. We have a php-mysql application. We need to save data on a SQL Server also. Initially we were using mssql_connect('server', 'db_user', 'db_pwd') to connect to the remote SQL server. but now we need to send it over ssl.

We would like to use the existing ssl cert already on server (currently used by site on IIS as ssl cert) to make it so we can connect to SQL Server with secure connection.

1
  • I am having the same issue. My site is hosted on php/mysql platform and I too need to update data on mssql. And I have already mentioned "mssql.secure_connection = ON" in my php.ini and the phpinfo is showing this enabled, but when I try to make connection to my mssql server 2008 using mssql_connect("server:port","username","password") an error arises that "Unable to connect to server: servername:port". I am using freeTDS. Commented Mar 1, 2011 at 7:46

2 Answers 2

3

What have you tried already ?

mssql_connect() should work out for you.

Since you provided no error I'm guessing: "Warning: mssql_connect(): Unable to connect to: OURSERVER.local in ...." ?

Have you set the mssql.secure_connection ini option to true?

Sign up to request clarification or add additional context in comments.

Comments

2

mssql_connect can use secured connection if php is configured ...

go into the php.ini and verify the mssql.secure_connection parameter :

[MSSQL]
mssql.secure_connection = On

2 Comments

Do you use Apache or IIS with PHP ?
i think that iis use the windows ssl certs and for apache i'm not sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.