在一台 Ubuntu 14.04 服务器上,PHP curl 文件上传可以正常工作,但在另一台 Ubuntu 14.04 上却出现错误

在一台 Ubuntu 14.04 服务器上,PHP curl 文件上传可以正常工作,但在另一台 Ubuntu 14.04 上却出现错误

我有一个非常奇怪的问题,我有两台装有 PHP 5.5 的 Ubuntu 14.04 服务器。我们的一个 PHP 脚本在服务器 A 上运行良好,但在服务器 B 上却出现错误。这是我的 curl 调用(来自 php)的详细输出,其中有效:

# php -f ocr-check.php
* Hostname was NOT found in DNS cache
*   Trying 69.64.69.77...
* Connected to www.ocrwebservice.com (69.64.69.77) port 80 (#0)
* Server auth using Basic with user 'done'
> POST /restservices/processDocument?gettext=true HTTP/1.1
Authorization: Basic ZG9uZTowRTVFQ0JDRS01OUZFLTRERkItQUU3RC1GQTRDMUU4MDlDQjU=
Host: www.ocrwebservice.com
Accept: */*
Content-Type: application/json
Content-Length: 149597
Expect: 100-continue

< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Length: 18125
< Content-Type: application/json; charset=utf-8
< Expires: -1
* Server Microsoft-IIS/7.5 is not blacklisted
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 29 Nov 2016 12:45:37 GMT
<
* Connection #0 to host www.ocrwebservice.com left intact
Array
(
    [url] => http://www.ocrwebservice.com/restservices/processDocument?gettext=true
    [content_type] => application/json; charset=utf-8
    [http_code] => 200
    [header_size] => 286
    [request_size] => 259
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 13.858555
    [namelookup_time] => 0.252775
    [connect_time] => 0.419635
    [pretransfer_time] => 0.419708
    [size_upload] => 149597
    [size_download] => 18125
    [speed_download] => 1307
    [speed_upload] => 10794
    [download_content_length] => 18125
    [upload_content_length] => 149597
    [starttransfer_time] => 0.586543
    [redirect_time] => 0
    [redirect_url] =>
    [primary_ip] => 69.64.69.77
    [certinfo] => Array
        (
        )

    [primary_port] => 80
    [local_ip] => 10.1.162.53
    [local_port] => 54870
)

其他 Ubuntu 服务器上的相同 php 脚本出现错误,详细信息如下:

# php -f ocr-check.php
    * Hostname was NOT found in DNS cache
    *   Trying 69.64.69.77...
    * Connected to www.ocrwebservice.com (69.64.69.77) port 80 (#0)
    * Server auth using Basic with user 'done'
    > POST /restservices/processDocument?gettext=true HTTP/1.1
    Authorization: Basic ZG9uZTowRTVFQ0JDRS01OUZFLTRERkItQUU3RC1GQTRDMUU4MDlDQjU=
    Host: www.ocrwebservice.com
    Accept: */*
    Content-Type: application/json
    Content-Length: 149597
    Expect: 100-continue

    < HTTP/1.1 403 Forbidden
    < Content-Type: text/html
    * Server Microsoft-IIS/7.5 is not blacklisted
    < Server: Microsoft-IIS/7.5
    < X-Powered-By: ASP.NET
    < Date: Tue, 29 Nov 2016 12:08:17 GMT
    < Content-Length: 1233
    * HTTP error before end of send, stop sending
    <
    * Closing connection 0
    Array
    (
        [url] => http://www.ocrwebservice.com/restservices/processDocument?gettext=true
        [content_type] => text/html
        [http_code] => 403
        [header_size] => 160
        [request_size] => 259
        [filetime] => -1
        [ssl_verify_result] => 0
        [redirect_count] => 0
        [total_time] => 0.362763
        [namelookup_time] => 0.013694
        [connect_time] => 0.187885
        [pretransfer_time] => 0.188209
        [size_upload] => 0
        [size_download] => 1233
        [speed_download] => 3398
        [speed_upload] => 0
        [download_content_length] => 1233
        [upload_content_length] => 149597
        [starttransfer_time] => 0.36236
        [redirect_time] => 0
        [redirect_url] =>
        [primary_ip] => 69.64.69.77
        [certinfo] => Array
            (
            )

        [primary_port] => 80
        [local_ip] => 10.1.10.193
        [local_port] => 60971
    )

需要紧急帮助来找出原因?服务器 B 是我们的生产服务器,它无法正常工作。我该如何调试此问题?

非常感谢您的帮助。

问候……Ketan

相关内容