0

I have very strange problem, I have 2 Ubuntu 14.04 servers with PHP 5.5. One of our PHP script runs fine from Server A but gives error from Server B. Here is my curl call (from php) verbose output where is works:

# 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
)

Same php script on other Ubuntu server gives error, see details below:

# 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
    )

Need urgent help to figure out why it is happening? Server B which is our production server where it does not work. How do I debug this issue?

Thanks a lot for any help.

Regards... Ketan

2
  • I did additional experiments using curl command in shell. On Server A it works but fails on Server B curl --trace-ascii debugdump.txt --user done:0E5ECBCE-59FE-4DFB-AE7D-XXXXXX --form =@test.pdf ocrwebservice.com/restservices/… part of --user parameter is replaced with XXXXXX for privacy purposes. Is there any other settings within Ubuntu that I need to look for? Thanks & regards...
    – Raj Saraf
    Nov 29 '16 at 14:43
  • On server A, I receive 100 (continue) and then it uploads file, on server B, I immediately receive 403 (forbidden) for exactly same url and same curl command. I am lost... how to find out what it is causing? Thanks a lot
    – Raj Saraf
    Nov 29 '16 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.