Category: errors

  • tesseract check_legal_image_size:Error:Only 1,2,4,5,6,8 bpp are supported:16

    Error:

    tesseract test.tif output.txt
    Tesseract Open Source OCR Engine
    check_legal_image_size:Error:Only 1,2,4,5,6,8 bpp are supported:16

    Cause: tif image bits/sample value not in 1,2,4,5,6,8 or tif image is transparent with alpha value (Extra Samples: 1<unassoc-alpha>):

    tiffinfo  test.tif
      TIFF Directory at offset 0x7b6 (1974)
      Image Width: 145 Image Length: 39
      Resolution: 72, 72 (unitless)
      Bits/Sample: 8
      Compression Scheme: AdobeDeflate
      Photometric Interpretation: min-is-black
      Extra Samples: 1<unassoc-alpha>
      FillOrder: msb-to-lsb
      Orientation: row 0 top, col 0 lhs
      Samples/Pixel: 2
      Rows/Strip: 39
      Planar Configuration: single image plane
      DocumentName: a.tif
      Software: ImageMagick 6.2.8 05/07/12 Q16
      Predictor: horizontal differencing 2 (0x2)

    Solution: convert tif to acceptable bit sample and remove alpha value:

    convert test.tif -background white -alpha remove -flatten -alpha off test.tif

    or convert to jpg and reconvert to tif again should remove alpha:

    convert test.tif test.jpg
    convert test.jpg test.tif

     

     

  • tesseract name_to_image_type:Error:Unrecognized image type

    Error:

    tesseract test.png output.txt
    Tesseract Open Source OCR Engine
    name_to_image_type:Error:Unrecognized image type:test.png
    IMAGE::read_header:Error:Can’t read this image type:test.png
    tesseract:Error:Read of file failed:test.png

    Cause: You are using tesseract version <=2.0.4

    Solution:

    1. convert png to tif:

    convert test.png -background white -alpha remove -flatten -alpha off test.tif

    2. Upgrade teeseract to latest version

     

     

     

  • MongoDB restore DB from MMS backup on shard clusters with different IPs than original shard

    When restore shards using MongoDB MMS backup files, if the new shard IP addresses are not the same as the IPs from where you do backup, MongoDB will raise the error “11002 exception: socket exception [CONNECT_ERROR] for <shard id/ip:port>” since the old IPs is stored in config server DB.

    Solution: Open a shell to MongoDB config server(s) and update the shard cluster IP in config DB:

    use config;
    db.shards.find()
    db.shards.update({_id: “shard_id”}, {$set: {“host”: “shard_id/new_ip:port”}} })

  • MongoDB error can’t add shard because a local database ‘test’ exists in another shard

    Error: When add shard with sh.addShard(), if new shard contains a DB with the same name as in previously added shards, MongoDB can’t automatically merge them:

    errmsg” : “can’t add shard server2:27017 because a local database ‘test’ exists in another shard000:server1:27017

    Solutions: mongodump the data on new shard, then drop that database and addShard. After that you can import the dump data using mongorestore

  • PHP cURL error code 60 SSL certificate problem self signed certificate in certificate chain

    Error: When using PHP curl_exec() to a site with https and self signed certificate (which should be likely a staging site, not a production site)

    Error code 60 SSL certificate problem: self signed certificate in certificate chain

    Solution:

    Since it is staging environment, we can completely ignore the certificate verification:

    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  • PHP cURL error code 7 failed to connect

    Error code 7 (CURLE_COULDNT_CONNECT) when calling curl_exec()

    $ch = curl_init("http://www.google.com");    
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($ch);
    print($data); // false
    print(curl_error($ch)); // Failed to connect to www.google.com 80
    print(curl_errno($ch)); // 7
    

    Solution:

    1. Check your internet connection

    2. Check your firewall

    3. Add your proxy if you are connecting through proxy:

    $proxy = “192.168.1.1:8080”;
    curl_setopt($ch, CURLOPT_PROXY, $proxy);

  • MongoDB Replica Set STARTUP2 error initial sync need a member to be primary or secondary to do our initial sync

    Error: MongoDB replica set stuck in STARTUP2 status with no replica becoming PRIMARY

     error initial sync need a member to be primary or secondary to do our initial sync

    Cause: You accidentally delete the local.* files in MongoDB DB path on one or multiple but not all replicas

    Solution: Stop all replicas, delete local.* on all replicas, and then start them and redo the rs.initiate() and rs.add() command from any replica member.

  • AuthenticationFailed MONGODB-CR credentials missing in the user document

    Error Description: When you are using MongoDB 3.0 and decide to use MONGODB-CR as password authentification mechanism instead of the default SCRAM-SHA-1 (or maybe MONGODB-CR is not your choice but is your legacy PHP/Java/Ruby driver support), the new user you create don’t have MONGODB-CR credentials as expected:

    use admin
    db.system.users.findOne({user: “”admin”,”})
    {
    “_id” : “admin.admin”,
    “user” : “admin”,
    “db” : “admin”,
    “credentials” : {
    “SCRAM-SHA-1” : {
    “iterationCount” : 10000,
    “salt” : “FPnmqmCI04KHJVZunfaI2Q==”,
    “storedKey” : “i+jvORcFsnx6CXt0Bd924e2f804=”,
    “serverKey” : “PQHG8nYYcJTjFEClqjFRZ8PTLTA=”
    },
    “MONGODB-CR” : “8aab8902fd862afad8064b73bd149d00”
    },
    “roles” : [
    {
    “role” : “userAdminAnyDatabase”,
    “db” : “admin”
    }
    ]
    }

    Cause: authSchemaVersion is set  to “5” and only SCRAM credentials will be generated in MongoDB 3.0:

    use admin
    db.system.version.find()
    { “_id” : “authSchema”, “currentVersion” : 5 }

    Solution: Restart mongod/mongos while disable –auth, then change authSchemaVersion to “3” to support MONGODB-CR. See https://jira.mongodb.org/browse/SERVER-17459

    use admin
    db.system.version.update({ “_id” : “authSchema”},{$set: {“currentVersion” : 3} })

  • MongoDB PHP Exception: Can’t connect over SSL, is mongod running with SSL?

    Error:Connect to MongoClient using SSL = true

    $mc = new MongoClient("mongodb://server1", array("ssl" => true));

    Cause: Your mongod instance is running but not properly configured with ssl.

  • MongoDB keyFile too open permissions

    Error: mongod cannot start with error: keyFile too open permissions

    Cause: Mongod key file accepts only mode 600 (read and write by owner only)

    chmod 600 ./keyFile