search
HomeBackend DevelopmentPHP Tutorial CentOS上的mssql_connect()连接有关问题,出现"Unable to connect to server"有关问题

求助:CentOS下的mssql_connect()连接问题,出现"Unable to connect to server"问题。
在CentOS系统下使用mssql_connect()时,一直出现“Unable to connect server”错误提示。

  背景: centOS系统的web服务器需要连接 MSSQL 的数据库服务器。mssql数据库使用的是MSSSQL2000,(MSSQL2008也试过,问题同样)。 

  centOS系统使用yum install方式安装了Freetds和php-mssql模块,使用phpinfo()查看php-mssql已经安装成功。在centOS下使用tsql测试连接mssql账号密码,都正确。但是php文件中使用mssql_connect()函数连接时,总出现“Unable to connect server”的故障提示(通过 error_log查询)。

  程序代码:
  $link = mssql_connect('192.168.100.10:1433', 'sa', '****'); //此处总出现错误,加不加端口号:1433,故障依旧 if (!$link)
  {
die('Unable to connect! error: ' . mssql_get_last_message());
  }
?>
   

  求高人解决!

------解决方案--------------------
就一个不能连接,无更明了的错误信息?
输出mssql_get_last_message()看看是啥
看样子是安装正常了,权限?sql server我遇过sa没录成功的情况,最终设置才解决
你再测试一下,争取得出更详尽的错误信息
------解决方案--------------------
还有你把ip换为localhost或是127.0.0.1再试试
------解决方案--------------------
你没权限,当然连不上去
------解决方案--------------------
是原有的代码吗? 我怎么看着mysql_connect()都写错了????
------解决方案--------------------
数据库端是另外一台windows的MSSqlServer服务器!!!
你是跨域访问吗,晕
默认安装的MSSQL,是不允许远程链接的,需要到 服务器配置管理器中,开放远程链接后,才能正常链接。
另外,远程链接,还受防火墙的影响,任何一端(即客户端和服务器端)的防火墙,都可以禁止其正常链接。
建议先配置好网络环境,再检查MSSQL的配置,最后才是检查您的PHP程序。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain how load balancing affects session management and how to address it.Explain how load balancing affects session management and how to address it.Apr 29, 2025 am 12:42 AM

Load balancing affects session management, but can be resolved with session replication, session stickiness, and centralized session storage. 1. Session Replication Copy session data between servers. 2. Session stickiness directs user requests to the same server. 3. Centralized session storage uses independent servers such as Redis to store session data to ensure data sharing.

Explain the concept of session locking.Explain the concept of session locking.Apr 29, 2025 am 12:39 AM

Sessionlockingisatechniqueusedtoensureauser'ssessionremainsexclusivetooneuseratatime.Itiscrucialforpreventingdatacorruptionandsecuritybreachesinmulti-userapplications.Sessionlockingisimplementedusingserver-sidelockingmechanisms,suchasReentrantLockinJ

Are there any alternatives to PHP sessions?Are there any alternatives to PHP sessions?Apr 29, 2025 am 12:36 AM

Alternatives to PHP sessions include Cookies, Token-based Authentication, Database-based Sessions, and Redis/Memcached. 1.Cookies manage sessions by storing data on the client, which is simple but low in security. 2.Token-based Authentication uses tokens to verify users, which is highly secure but requires additional logic. 3.Database-basedSessions stores data in the database, which has good scalability but may affect performance. 4. Redis/Memcached uses distributed cache to improve performance and scalability, but requires additional matching

Define the term 'session hijacking' in the context of PHP.Define the term 'session hijacking' in the context of PHP.Apr 29, 2025 am 12:33 AM

Sessionhijacking refers to an attacker impersonating a user by obtaining the user's sessionID. Prevention methods include: 1) encrypting communication using HTTPS; 2) verifying the source of the sessionID; 3) using a secure sessionID generation algorithm; 4) regularly updating the sessionID.

What is the full form of PHP?What is the full form of PHP?Apr 28, 2025 pm 04:58 PM

The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

How does PHP handle form data?How does PHP handle form data?Apr 28, 2025 pm 04:57 PM

PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

What is the difference between PHP and ASP.NET?What is the difference between PHP and ASP.NET?Apr 28, 2025 pm 04:56 PM

The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

Is PHP a case-sensitive language?Is PHP a case-sensitive language?Apr 28, 2025 pm 04:55 PM

PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool