In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to solve the sqlserver error in php connection". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the sqlserver error in php connection".
Php connection sqlserver error solution: 1, open php.in and remove the extension=php_mssql.dll comment symbol; 2, find the ntwdblib.dll file; 3, run SQL Server configuration manager and set the port.
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
What if there is an error in the php connection sqlserver?
On the problem of connecting php to sqlserver
Several points that should be paid attention to when connecting sqlserver2000 with php
1. Configure php
A. Open php.in to remove the annotation symbols from extension=php_mssql.dll.
B, open php.in, if your program and database are on the same server, please change mssql.secure_connection = Off to on, if on two servers, please change to off, otherwise it will report an error such as "user (Null) login failure".
C. Copy the php_mssql.dll to the directory specified by extension_dir in php.in or to the system system32 directory. Php_mssql.dll is available in the compressed installation package of php.
two。 Note the ntwdblib.dll file
a. Find the ntwdblib.dll file in the system system32 directory of the server with sqlserver2000, check its version through the properties, and then overwrite the corresponding files in the php directory of the program server by this standard.
b. Also need to overwrite the corresponding files under apache2/bin! (a lot of people can't connect because they don't notice this step, and so do I.)
You need to restart apache after the above steps are completed.
Note: in practice, it is found that if you manually install php to iis through a php zip file, you must restart the machine instead of just iis.
3. Configure sqlserver
a. Run SQL Server configuration Manager: SQL Server Configuration Manager, and open the protocol Protocols
b. Allow named pipes "named pipes" and "tcp/ip"
c. Right-click "tcp/ip" to open the attribute Properties tab "IP addresses"
d. Enter 1433 in the TCP dynamic port "TCP Dynamic Ports"
e. Restart SQL Server
4. Connect to MS SQL Server 2005 in the following ways:
The code is as follows:
Can see that these functions and MySQL functions are corresponding to it is very convenient to use!
5.FAQ FAQ:
1 error:
Fatal error: Call to undefined function mssql_connect ()
Resolve:
Use MSSQL_ series functions
To use both of these, you need to set them in php.ini:
(1) to allow DCOM, you need to remove the semicolon ";" before "com.allow_dcom=TRUE" in php.ini.
(2) to use MSSQL extension, you need to remove the semicolon ";" before extension=php_mssql.dll in php.ini. (key)
(3) confirm that extension_dir is the correct path. Take the local machine as an example: extension_dir = "c:\ AppServ\ php5\ ext".
(4) if the machine still reports an error that c:\ AppServ\ php5\ ext\ php_mssql.dll can not be found, but this file clearly exists.
Solution: copy the php_mssql.dll,ntwdblib.dll to the system directory\ system32 to restart the test.
(note: the above two dll files are not in the same directory, mine is c:\ AppServ\ php5\ ext\ php_mssql.dll;c:\ AppServ\ php5\ ntwdblib.dll)
And copy ntwdblib.dll to the apache2/bin/ directory!
In addition, remember to restart the server when it is set up.
6. Other questions:
If the php apache Sql Server2000 are all on the same machine, there is almost no problem with access.
If the Sql Server2000 and php machines are separate, you need to make sure that the machine name of the ping sqlserver machine is workable. If not, modify the hosts file under\ system32\ drivers\ etc of the machine where the php belongs, and add the name of the machine where the sqlserver belongs to the machine ip sqlserver.
If it is still unreachable, you need to make sure that the machine where php is located has been converted to mdac. Why not just install the client of sqlserver.
Thank you for reading, the above is the content of "how to solve php connection sqlserver error". After the study of this article, I believe you have a deeper understanding of how to solve the problem of php connection sqlserver error, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.