PHP and MS SQL Enterprise Problems | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | |
I am working with PHP and need it to connect to a MS SQL Enterprise database on a different server. I have read TONS of suggestions and nothing works, here is the situation:
-IIS is on a Win XP Pro System with PHP5 Installed (the rest of php seems to be running fine).
-extension=php_mssql.dll is uncommented- not only has the service been restarted but the computer has been rebooted several times
-We are NOT running Apache as well.
-SQL Server is version 8 running on a Win 2003 Server
-the ntwdblib.dll file from the SQL server is copied to the XP system in the system32, php AND php/ext directories
-SQL Server is set up for both named pipes and TCP/IP
-SQL Server will accept both NT authorization and SQL server logins
Here is my code:
$connection = @mssql_connect('SQLServer','usrnm','psswd');
echo 'Made it bast the attempt to connect';
if (!$connection)
{
echo 'Could not connect'; }
else { echo 'Connected';}'
The Web stops when it gets to the connect statement, it will not send any of the echo'd statements.
I have found code statements with and without the leading '@', without it, I get:
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\NewSite\news.php on line 47
Can someone please help, I am up against a wall and connot contiue with the website until I figure out the configuration problem.
Thanks
|  | Moderator | | Join Date: Jul 2006 Location: Pakistan
Posts: 719
| | | re: PHP and MS SQL Enterprise Problems Quote:
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\NewSite\news.php on line 47
It shows you have not installed MSSQL extension successfully. Check out this http://www.php.net/manual/en/ref.mssql.php.
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I've read that, I can't find what I'm missing.
The ntwsdblib.dll is available on the IIS machine, the php_mssql.dll is uncommented in the php.ini and is located in the php/ext directory. The php/ext directory is where php is looking for it's dll's. What else is there to do? I've been fighting with this for over a week and I need to get this working.
Please someone help me, I'm so frustrated.
|  | Moderator | | Join Date: Jan 2007 Location: Maine, USA
Posts: 2,904
| | | re: PHP and MS SQL Enterprise Problems
Have you installed the SQL Server Client Tools?
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
Client Tools are installed.
I've installed the newest service pack for SQL Server as well.
It seems that the dll isn't loading and I can't figure out why. Everything is where it should be (as near as I can tell) and uncommented. I even made sure that there weren't 2 php.ini files and it was loading a different one than I edited; that wasn't it either.
|  | Moderator | | Join Date: Jan 2007 Location: Maine, USA
Posts: 2,904
| | | re: PHP and MS SQL Enterprise Problems Quote:
Originally Posted by AmyHanson Client Tools are installed.
I've installed the newest service pack for SQL Server as well.
It seems that the dll isn't loading and I can't figure out why. Everything is where it should be (as near as I can tell) and uncommented. I even made sure that there weren't 2 php.ini files and it was loading a different one than I edited; that wasn't it either. What installer did you use for Apache, PHP, and MySQL?
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
We do not have Apache.
We are using MS SQL Enterprise, not MySQL and it was installed using the original CD on the server.
The PHP was installed using the manual installation directions on php.net.
I don't mean to sound short, I have just lost my patience with this problem as it makes no sense.
|  | Moderator | | Join Date: Jan 2007 Location: Maine, USA
Posts: 2,904
| | | re: PHP and MS SQL Enterprise Problems Quote:
Originally Posted by AmyHanson We do not have Apache.
We are using MS SQL Enterprise, not MySQL and it was installed using the original CD on the server.
The PHP was installed using the manual installation directions on php.net.
I don't mean to sound short, I have just lost my patience with this problem as it makes no sense. My apologies for my miswording and assumptions, I understand that this is a MSSQL problem, I just can't type.
What version of PHP do you have installed. What version of IIS are you using?
I am going to assume that phpinfo does not show any MSSQL information. Correct me if that assumption is wrong.
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I really do appreciate the help, this is driving me buggy. I can understand mistyping, there is a typo in one of the echo statements I was using to see where the code dies. I guess I'm just frustrated with all the help sites seem to concentrate on MySQL and some don't even acknowledge that there are any other databases out there.
I am using the IIS server that installs with Windows XP Pro. 5.1
I am using PHP5 (not sure how to get more detailed than that, it isn't as easy to locate as in a Window's app).
And you are correct. When I run phpinfo() it says nothing about mssql.
I guess this is what you get when you assign a setup/configuration issue to a programmer and dba.
|  | Moderator | | Join Date: Jan 2007 Location: Maine, USA
Posts: 2,904
| | | re: PHP and MS SQL Enterprise Problems Quote:
Originally Posted by AmyHanson I really do appreciate the help, this is driving me buggy. I can understand mistyping, there is a typo in one of the echo statements I was using to see where the code dies. I guess I'm just frustrated with all the help sites seem to concentrate on MySQL and some don't even acknowledge that there are any other databases out there.
I am using the IIS server that installs with Windows XP Pro. 5.1
I am using PHP5 (not sure how to get more detailed than that, it isn't as easy to locate as in a Window's app).
And you are correct. When I run phpinfo() it says nothing about mssql.
I guess this is what you get when you assign a setup/configuration issue to a programmer and dba. I understand entirely (after all, I am the mod for the SQL Server forum). I have had numerous problems setting up MSSQL to work with PHP on Windows, and I have never been able to narrow down a solution that works all of the time. If you have the time, you may want to pursue an alternative; the FreeTDS package should allow you to access MSSQL, and you can find instructions for it here.
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I understood that package was for Linux/Unix. Not Windows.
I have seen several places where a file called config.php is refered to, I don't have that anywhere on my PC. They refer to it as well.
I've started looking into it and it looks to be as big a problem as php itself. That site was confusing as it seems to be the installation directions for a piece of software that uses FreeTDS.
So, I went to the FreeTDS site itself and isn't much better. It talks about using 'ntbox.mydomain.com' as the server name. The site I'm working on is for an intranet and the server and IIS are on different boxes. I only have the server name and IP the rest is web related isn't it?
I hate feeling this usless. It can't be this difficult.
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I just tried seeing if I can get any of the other libraries to load, it doesn't seem to be a MSSQL problem. PHP isn't loading any of the extension=... that are uncommented.
|  | Moderator | | Join Date: Jan 2007 Location: Maine, USA
Posts: 2,904
| | | re: PHP and MS SQL Enterprise Problems Quote:
Originally Posted by AmyHanson I just tried seeing if I can get any of the other libraries to load, it doesn't seem to be a MSSQL problem. PHP isn't loading any of the extension=... that are uncommented. Is your extension directory correctly set?
Have you restarted IIS after making changes?
Are you modifing the correct php.ini?
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I have restarted the service more times that I can count. I've even rebooted a few times (actually due to a different thing here on the network involving the roaming profiles and a few times out of frustration).
The extension directory is set to c:\php\ext and that is where the dll's are.
And I already thought of the php.ini problem, there is only one on the PC, it is in the c:\php folder and that directory is in the path for the system.
| | Newbie | | Join Date: Jul 2007 Location: East of Cleveland, OH
Posts: 10
| | | re: PHP and MS SQL Enterprise Problems
I got over the first hurdle!
It seems that I had done the IIS config wierd, I had done part cgi and part isapi. Once I switched it all to cgi it is loading the libraries!
Now I just have to figure out the login failures. At least here I'm a little more solid ground.
Thanks for you help, at least for letting me bounce things around in your direction.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,439 network members.
|