doutang7707 2017-03-10 15:49
浏览 48

MSSQL PHP远程连接

UPDATE:

Downgraded to PHP 5.5.38 - Still not working.

_

I'm trying to connect to a remote mssql database that is on my network.

I have tried this bit of code:

<?php
// Server in the this format: <computer>\<instance name> or
// <server>,<port> when using a non default port number
$server = '192.168.2.254\HQ';

// Connect to MSSQL
$link = mssql_connect($server, 'username', 'password');

if (!$link) {
    die('Something went wrong while connecting to MSSQL');
}
?>

On run I get the following error:

    [10-Mar-2017 16:35:51 Europe/Berlin] PHP Fatal error:  Uncaught Error: Call to undefined function mssql_connect() in /Applications/MAMP/htdocs/Inventory_Management/public_html/connectionTest.php:13
Stack trace:
#0 {main}
  thrown in /Applications/MAMP/htdocs/Inventory_Management/public_html/connectionTest.php on line 13

After some research, I found this video stating I should download a few .dll files and restart Apache. https://www.youtube.com/watch?v=-UoXk8qJ82Y

However, I'm running locally using MAMP on a mac. Any ideas here?

Additional Info:

PHP Version 7.1.1

System  Darwin Andy-iMac.local 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64
Build Date  Jan 23 2017 14:35:48
Configure Command   './configure' '--with-apxs2=/Applications/MAMP/Library/bin/apxs' '--with-gd' '--with-jpeg-dir=/Applications/MAMP/Library' '--with-png-dir=/Applications/MAMP/Library' '--with-zlib' '--with-zlib-dir=/Applications/MAMP/Library' '--with-freetype-dir=/Applications/MAMP/Library' '--prefix=/Applications/MAMP/bin/php/php7.1.1' '--exec-prefix=/Applications/MAMP/bin/php/php7.1.1' '--sysconfdir=/Applications/MAMP/bin/php/php7.1.1/conf' '--with-config-file-path=/Applications/MAMP/bin/php/php7.1.1/conf' '--enable-ftp' '--enable-gd-native-ttf' '--with-bz2=/Applications/MAMP/Library' '--with-ldap' '--with-mysqli=mysqlnd' '--enable-mbstring=all' '--with-curl=/Applications/MAMP/Library' '--enable-sockets' '--enable-bcmath' '--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007f' '--with-imap-ssl=/Applications/MAMP/Library' '--enable-soap' '--with-kerberos' '--enable-calendar' '--with-pgsql=shared,/Applications/MAMP/Library/pg' '--enable-exif' '--with-libxml-dir=/Applications/MAMP/Library' '--with-gettext=shared,/Applications/MAMP/Library' '--with-xsl=/Applications/MAMP/Library' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=shared,/Applications/MAMP/Library/pg' '--with-mcrypt=shared,/Applications/MAMP/Library' '--with-openssl=/Applications/MAMP/Library' '--enable-zip' '--with-iconv=/Applications/MAMP/Library' '--enable-opcache' '--enable-intl' '--with-tidy=shared' '--with-icu-dir=/Applications/MAMP/Library' '--enable-wddx' '--with-libexpat-dir=/Applications/MAMP/Library' '--with-readline' '--with-mhash' 'YACC=/Applications/MAMP/Library/bin/bison'
Server API  Apache 2.0 Handler
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /Applications/MAMP/bin/php/php7.1.1/conf
Loaded Configuration File   /Applications/MAMP/bin/php/php7.1.1/conf/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed    (none)
PHP API 20160303
PHP Extension   20160303
Zend Extension  320160303
Zend Extension Build    API320160303,NTS
PHP Extension Build API20160303,NTS
Debug Build no
Thread Safety   disabled
Zend Signal Handling    enabled
Zend Memory Manager enabled
Zend Multibyte Support  provided by mbstring
IPv6 Support    enabled
DTrace Support  disabled
Registered PHP Streams  https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters   zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?