使用包含€

时间:2018-01-25 16:49:30

标签: php sql-server pdo

我试图从我的linux服务器登录到mssql server,不幸的是,密码包含字符。似乎这个角色没有通过(正确)发送。任何人都知道如何使这项工作?

正如您在日志中看到的那样,freedts配置正在运行,并且正在将主机名解析为正确的ip和端口。但仔细查看我的密码被发送的包裹,似乎已被...取代

00d0 00 09 4d 79 e2 82 ac 50-61 73 73 77 6f 72 64 00 |..My...P assword.|

freetds.conf

[mannequin]
        host = XX.XXX.XXX.XXX
        port = 55214
        tds version = auto
        dump file = /var/www/vhosts/example.com/httpdocs/temp/freetds.log

PHP

<?php
        $servername = 'mannequin';
        $user = 'webshop';
        $pass = 'My€Password';
        //$pass = 'azerty';
        $dsn = 'dblib:charset=UTF-8;host='.$servername;

        try {
            $con = new PDO($dsn, $user, $pass);
        }catch(\Exception $e) {
            echo $e->getMessage().'<hr />';
            highlight_file(__DIR__ . '/../../temp/freedts.log');
        }
        exit;

freetds.log

log.c:196:Starting log file for FreeTDS 0.91
    on 2018-01-25 17:38:30 with debug flags 0x4fff.
iconv.c:330:tds_iconv_open(0x7f0f2b5f1670, UTF-8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:349:setting up conversions for client charset "UTF-8"
iconv.c:351:preparing iconv for "UTF-8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "ISO-8859-1" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to XX.XXX.XXX.XXX port 55214 (TDS version 4.2)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:310:tds_open_socket() succeeded
util.c:156:Changed query state from DEAD to IDLE
net.c:741:Sending packet
0000 02 00 02 00 00 00 00 00-70 75 62 6c 69 34 75 2d |........ xxxxxxx-|
0010 77 65 62 30 30 32 2e 73-72 76 2e 63 6f 6d 62 65 |xxxxxx.s rv.xxxxx|
0020 6c 6c 2d 6f 70 73 1e 77-65 62 73 68 6f 70 00 00 |ll-ops.w ebshop..|
0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0040 00 00 00 00 00 07 4d 79-e2 82 ac 50 61 73 73 77 |......My ...Passw|
0050 6f 72 64 00 00 00 00 00-00 00 00 00 00 00 00 00 |ord..... ........|
0060 00 00 00 00 0d 31 33 39-33 36 00 00 00 00 00 00 |.....139 36......|
0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0080 00 00 00 05 03 01 06 0a-09 01 00 00 00 00 02 00 |........ ........|
0090 00 00 00 00 50 48 50 20-66 72 65 65 74 64 73 00 |....PHP  freetds.|
00a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00b0 00 00 0b 6d 61 6e 6e 65-71 75 69 6e 00 00 00 00 |...manne quin....|
00c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00d0 00 09 4d 79 e2 82 ac 50-61 73 73 77 6f 72 64 00 |..My...P assword.|
00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01b0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01d0 00 0d 04 02 00 00 44 42-2d 4c 69 62 72 61 72 79 |......DB -Library|
01e0 0a 00 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|
01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|

net.c:741:Sending packet
0000 02 01 00 4c 00 00 00 00-00 00 00 00 00 00 0a 00 |...L.... ........|
0010 00 00 00 00 00 00 00 00-00 00 00 00 00 75 74 66 |........ .....utf|
0020 38 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |8....... ........|
0030 00 00 00 00 00 00 00 00-00 00 00 04 01 35 31 32 |........ .....512|
0040 00 00 00 03 00 00 00 00-00 00 00 00             |........ ....|

token.c:328:tds_process_login_tokens()
net.c:555:Received header
0000 04 01 00 50 00 37 01 00-                        |...P.7..|

net.c:609:Received packet
0000 04 01 00 50 00 37 01 00-aa 3c 00 18 48 00 00 01 |...P.7.. .<..H...|
0010 0e 20 00 4c 6f 67 69 6e-20 66 61 69 6c 65 64 20 |. .Login  failed |
0020 66 6f 72 20 75 73 65 72-20 27 77 65 62 73 68 6f |for user  'websho|
0030 70 27 2e 10 53 45 52 56-45 52 50 43 5c 53 51 4c |p'..SERV ERPC\SQL|
0040 32 30 31 34 00 01 00 fd-02 00 00 00 00 00 00 00 |2014.... ........|

token.c:337:looking for login token, got  aa(ERROR)
token.c:122:tds_process_default_tokens() marker is aa(ERROR)
token.c:2588:tds_process_msg() reading message 18456 from server
token.c:2661:tds_process_msg() calling client msg handler
dbutil.c:85:_dblib_handle_info_message(0x7f0f27e41c70, 0x7f0f2b5f1670, 0x7fff42a4de00)
dbutil.c:86:msgno 18456: "Login failed for user 'webshop'."
dblib.c:5780:dbgetuserdata(0x7f0f2b5927f0)
dblib.c:5780:dbgetuserdata(0x7f0f2b5927f0)
token.c:2674:tds_process_msg() returning TDS_SUCCEED
token.c:337:looking for login token, got  fd(DONE)
token.c:122:tds_process_default_tokens() marker is fd(DONE)
token.c:2339:tds_process_end: more_results = 0
        was_cancelled = 0
        error = 1
        done_count_valid = 0
token.c:2355:tds_process_end() state set to TDS_IDLE
token.c:2370:                rows_affected = 0
token.c:438:tds_process_login_tokens() returning TDS_FAIL
login.c:466:login packet accepted
util.c:156:Changed query state from IDLE to DEAD
util.c:331:tdserror(0x7f0f27e41c70, 0x7f0f2b5f1670, 20002, 0)
dblib.c:7929:dbperror(0x7f0f2b5927f0, 20002, 0)
dblib.c:7981:20002: "Adaptive Server connection failed"
dblib.c:5780:dbgetuserdata(0x7f0f2b5927f0)
dblib.c:8002:"Adaptive Server connection failed", client returns 2 (INT_CANCEL)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
dblib.c:1443:dbclose(0x7f0f2b5927f0)
dblib.c:258:dblib_del_connection(0x7f0f0d351640, 0x7f0f2b5f1670)
mem.c:615:tds_free_all_results()
dblib.c:305:dblib_release_tds_ctx(1)
dblib.c:5882:dbfreebuf(0x7f0f2b5927f0)

DTS版本是4.2而不是7或8。 使用7或8时,日志会显示:

  

服务器发送了意外的EOF

然后连接关闭。

小更新

问题得到解决&#34;通过请求没有特殊字符的新密码。但必须注意我必须将DTS版本更改为8.0,否则我无法接收unicode数据(一般错误4004)

必须注意的是,我仍然可以连接到DTS 8.0的服务器,因此我在该版本中获得的EOF响应与a无关版本不匹配,但也是由于密码中的

  

无法使用DB-Library(例如ISQL)或ODBC 3.7或更早版本,无法将仅使用Unicode的归类或ntext数据中的Unicode数据发送到客户端。

0 个答案:

没有答案