In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to solve the failure of php connection to mssql. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Php connection mssql failed solutions: 1, find extension=php_mssql.dll in the php.ini file and remove the previous semicolon; 2, copy the php_mssql.dll file to the "c:/windows/system32/" directory; 3, restart iis.
This article operating environment: windows7 system, PHP5 version, DELL G3 computer
The solution to PHP's inability to connect to the MSSQL database:
Php database sqlserver extension sqlserver server
Today, I received a question about accessing sqlserver2000 data on php5+iis6+mysql5 's platform environment. As a result, the runtime found an error in php connecting to the remote mssql database. The error code is as follows:
Warning: mssql_connect (): Unable to connect to server:
Think about the past is no problem, how to return the matter? Later, when I searched the Internet and found an article, I found that the original server needed to install mssql to connect to mssql with php. Originally, I didn't need to use mssql on the new server, but now I have no choice but to extend it. After extending mssql, there will be no problem.
Expansion method:
1. Find in the c:/windows/php.ini file
Extension=php_mssql.dll remove the semicolon from the front
find
; extension_dir = ". /" change the extended library directory to the php library directory, such as: extension_dir = "c:/php/ext"
2. Copy the php_mssql.dll file to the c:/windows/system32/ directory
3. Restart iis.
The following is an article found.
Php configuration:
Set it in the php.ini file as follows, and find the
Extension=php_mssql.dll remove the semicolon from the front
Find extension_dir = d:/extension/
Your php.ini may not contain d:/extension/.
Change to php_mssql.dll under the extensions directory under the php installation directory, the path if you haven't moved it somewhere else (assuming your php installation path is d:/php)
Change it to extension_dir=d:/php/extensions/.
Then restart the web server
This is easy to do, but it still can't be connected after such a setup, and the error message is as follows:
MS SQL Server database connection error! Please check whether the database host variable is set correctly!
On the other hand, I checked the variable settings of the host over and over again, and there was no problem with those settings. I searched the web page and found the following clues:
Php.com data: I am trying to connect to SQL Server 2000 from PHPI bumped to following warning:Warning: mssql_connect (): Unable to connect to server: SERVER/Portal. On line 5on line 5 there is:$db_connect = mssql_connect ('SERVER/Portal',' sa', 'my_passwd') I did the following1.enabled php_mssql.dll extension in PHP.ini2.every dll is in proper place (System32 or PHP folder), including ntwdblib.dllI search lots of profile throught web, but no one give me proper answer to resolve it.after a few hour, I found the problem was caused byntwdblib.dll, which version is 7.00.839, when I replaced old ntwdblib.dll with the newntwdblib.dll, which version is 8.00.194, all problem are solved.We had some, read A LOT, of problems with MSSQL under Windows 2003.We had 2 the same windows, php, php-ini Everything machines but only one could connect.Unable to connect was the error message.Finnaly we checked the version of ntwdblib.dll and the one distributed with PHP was 7.00....and the version of the one on the SQL Server install was 8.00.... So we copied this one inthe php and apache dir and it worked.
The problem was found in this way, and it was ntwdblib.dll that caused the trouble.
The main role of ntwdblib.dll is to provide sql server connection services.
The version of php I used is 5.25. Under the windows/system32/ of the server that installed it, I found that the version of the ntwdblib.dll file is 2000.2.8.0. This version supports sql server 7.0, because when installing PHP, all files under dlls will be overwritten to the system.
Directory, so it certainly won't work when I use it to connect to sql server 2000.
Later, I found that the version of ntwdblib.dll on a server that normally installed sql server 2000 was 2000.80.2039.0. I copied this file, overwrote the previous version, and everything was fine after restarting the server.
Add: if the database name begins with a number, it will also prompt that it cannot be opened, then the simple thing to do is to enclose the database name in parentheses [], such as rewriting 123bbs into [123bbs], and this will also happen if your database name conflicts with the reserved words in sql server, which can also be solved with brackets.
In the end, the problem that PHP could not connect sql server 2000 correctly was finally solved. Although it took more than half a day, the harvest was still great. Posting it now will also make fewer detours for brothers who encounter the same problem.
Finally, if your target MSSQL computer is equipped with a firewall, please open port 1433, especially the windows xp system!
Read the above information to install sqlserver2000 friends to upload the "ntwdblib.dll" file I, my local test was really successful, but uploaded to the server, the result info () no mssql extension, originally loaded how there is no difference between the php.ini file and the local comparison, that is, can not expand, everything is normal locally.
In the end, it was found that there was a problem with the version of "ntwdblib.dll" and a higher version of "ntwdblib.dll" was found to replace it.
This is the end of this article on "how to solve the problem of php connection mssql failure". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.