Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a custom .so module doesn't seem to work #190

Closed
michaelmillar opened this issue Feb 6, 2018 · 14 comments
Closed

Adding a custom .so module doesn't seem to work #190

michaelmillar opened this issue Feb 6, 2018 · 14 comments
Assignees

Comments

@michaelmillar
Copy link
Contributor

michaelmillar commented Feb 6, 2018

I am trying to install MongoClient (the deprecated mongo.so not mongodb.so, but which I have working on my original system) in the devilbox container.

I followed the instructions here

so

cp /usr/lib/php/20131226/mongo.so /var/www/devilbox/mod/php-fpm-5.6/

and

cp /etc/php/5.6/mods-available/mongo.ini /var/www/devilbox/cfg/php-fpm-5.6/00-mongo.ini

But in the container I am still seeing MongoClient not found.

Otherwise, normally, I can do something like

sudo yum install openssl-devel php-devel
sudo yum groupinstall "Development tools" -y
sudo pecl install mongo
put extension=mongo.so in php.ini
restart httpd/apache

which works, except the restarting doesn't seem to be possible in the container.

Any ideas on how to proceed?

Container
PHP 5.6.33
MySQL 5.7
Apache 2.2
MongoDB (server) 2.8

Host
Ubuntu 16.04
Docker version 1.13.1, build 092cba3
docker-compose version 1.16.1, build 6d1ac21

@cytopia
Copy link
Owner

cytopia commented Feb 8, 2018

Did you also adjust the path inside mongo.ini to actually point to the so inside the container?

@michaelmillar
Copy link
Contributor Author

So according to this I add in cfg/php-fpm-5.6/00-mongo.ini

extension=/usr/lib64/php/custom-modules/mongo.so

When I run docker-compose up the log states

PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongo.so' - libcrypto.so.1.1: cannot open shared object file: No such file or directory in Unknown on line 0

I also tried with

extension=/var/www/devilbox/mod/php-fpm-5.6/mongo.so

but there is the same result

The libcrytpo.so error has precedents, for example here, or here, but the files don't exist at the location the poster suggests copying from.

@cytopia
Copy link
Owner

cytopia commented Feb 8, 2018

Yes, looks like a library problem. Then you need to wait another 1-2 weeks until the new PHP Docker images will arrive

@cytopia
Copy link
Owner

cytopia commented Mar 5, 2018

This should fix your problem. Please let me know if it works (mongo.so already bundled now): #203

@cytopia cytopia self-assigned this Mar 5, 2018
@michaelmillar
Copy link
Contributor Author

michaelmillar commented Mar 6, 2018

I followed the three steps in #203

I also tweaked the .env file to make my app load, but only

  1. php version 5.6
  2. mysql 5.7
  3. the locations of HOST_PATH_HTTPD_DATADIR and HOST_PATH_MYSQL_DATADIR
  4. MYSQL_ROOT_PASSWORD

When I run docker compose up in the startup messages mongo exits:

mongo_1  | 2018-03-06T09:53:20.988+0000 I -        [initandlisten] Invariant failure: ret resulted in status UnknownError: -31802: WT_ERROR: non-specific WiredTiger error at src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp 69
mongo_1  | 2018-03-06T09:53:20.988+0000 I -        [initandlisten] 
mongo_1  | 
mongo_1  | ***aborting after invariant() failure
mongo_1  | 
mongo_1  | 
mongo_1  | 2018-03-06T09:53:21.014+0000 F -        [initandlisten] Got signal: 6 (Aborted).
mongo_1  | 
mongo_1  |  0x55c721e0f681 0x55c721e0e899 0x55c721e0ed7d 0x7fb952c9b890 0x7fb952916067 0x7fb952917448 0x55c7210b9a83 0x55c721b1ab4f 0x55c721b0481d 0x55c721afcbbc 0x55c7219efaf0 0x55c7210a5e3e 0x55c7210c5a26 0x7fb952902b45 0x55c7211250cf
mongo_1  | ----- BEGIN BACKTRACE -----
mongo_1  | {"backtrace":[{"b":"55C72089D000","o":"1572681","s":"_ZN5mongo15printStackTraceERSo"},{"b":"55C72089D000","o":"1571899"},{"b":"55C72089D000","o":"1571D7D"},{"b":"7FB952C8C000","o":"F890"},{"b":"7FB9528E1000","o":"35067","s":"gsignal"},{"b":"7FB9528E1000","o":"36448","s":"abort"},{"b":"55C72089D000","o":"81CA83","s":"_ZN5mongo25fassertFailedWithLocationEiPKcj"},{"b":"55C72089D000","o":"127DB4F","s":"_ZN5mongo20WiredTigerSizeStorerC1EP15__wt_connectionRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE"},{"b":"55C72089D000","o":"126781D","s":"_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb"},{"b":"55C72089D000","o":"125FBBC"},{"b":"55C72089D000","o":"1152AF0","s":"_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv"},{"b":"55C72089D000","o":"808E3E"},{"b":"55C72089D000","o":"828A26","s":"main"},{"b":"7FB9528E1000","o":"21B45","s":"__libc_start_main"},{"b":"55C72089D000","o":"8880CF"}],"processInfo":{ "mongodbVersion" : "3.4.13", "gitVersion" : "fbdef2ccc53e0fcc9afb570063633d992b2aae42", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.4.0-116-generic", "version" : "#140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018", "machine" : "x86_64" }, "somap" : [ { "b" : "55C72089D000", "elfType" : 3, "buildId" : "8547E1597CCF5A1E85EA8A2E742B7CB5150D50DC" }, { "b" : "7FFC397EF000", "path" : "linux-vdso.so.1", "elfType" : 3, "buildId" : "2743AEADCDA27954EA08FA4C94C6DB97E2A37F92" }, { "b" : "7FB953BC8000", "path" : "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "21115992A1F885E1ACE88AADA60F126AD9759D03" }, { "b" : "7FB9537CC000", "path" : "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "FD6376149047833953B0269E84DE181CA45DBE90" }, { "b" : "7FB9535C4000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "A63C95FB33CCA970E141D2E13774B997C1CF0565" }, { "b" : "7FB9533C0000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "D70B531D672A34D71DB42EB32B68E63F2DCC5B6A" }, { "b" : "7FB9530BF000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "152C93BA3E8590F7ED0BCDDF868600D55EC4DD6F" }, { "b" : "7FB952EA9000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "D5FB04F64B3DAEA6D6B68B5E8B9D4D2BC1A6E1FC" }, { "b" : "7FB952C8C000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "9DA9387A60FFC196AEDB9526275552AFEF499C44" }, { "b" : "7FB9528E1000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "48C48BC6ABB794461B8A558DD76B29876A0551F0" }, { "b" : "7FB953E29000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "1D98D41FBB1EABA7EC05D0FD7624B85D6F51C03C" } ] }}
mongo_1  |  mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55c721e0f681]
mongo_1  |  mongod(+0x1571899) [0x55c721e0e899]
mongo_1  |  mongod(+0x1571D7D) [0x55c721e0ed7d]
mongo_1  |  libpthread.so.0(+0xF890) [0x7fb952c9b890]
mongo_1  |  libc.so.6(gsignal+0x37) [0x7fb952916067]
mongo_1  |  libc.so.6(abort+0x148) [0x7fb952917448]
mongo_1  |  mongod(_ZN5mongo25fassertFailedWithLocationEiPKcj+0x0) [0x55c7210b9a83]
mongo_1  |  mongod(_ZN5mongo20WiredTigerSizeStorerC1EP15__wt_connectionRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1CF) [0x55c721b1ab4f]
mongo_1  |  mongod(_ZN5mongo18WiredTigerKVEngineC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_PNS_11ClockSourceES8_mbbbb+0xC3D) [0x55c721b0481d]
mongo_1  |  mongod(+0x125FBBC) [0x55c721afcbbc]
mongo_1  |  mongod(_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv+0x6B0) [0x55c7219efaf0]
mongo_1  |  mongod(+0x808E3E) [0x55c7210a5e3e]
mongo_1  |  mongod(main+0x966) [0x55c7210c5a26]
mongo_1  |  libc.so.6(__libc_start_main+0xF5) [0x7fb952902b45]
mongo_1  |  mongod(+0x8880CF) [0x55c7211250cf]
mongo_1  | -----  END BACKTRACE  -----
devilbox_mongo_1 exited with code 14

@cytopia
Copy link
Owner

cytopia commented Mar 7, 2018

Looks like official mongo container have some problems. I have tried mongo 2.8 and mongo 3.0, both crash. Mongo 3.2 works. Can you give it a shot.

@cytopia
Copy link
Owner

cytopia commented Mar 8, 2018

Looks like a mongodb problem. I have created an issue at their repository:
docker-library/mongo#251

@cytopia cytopia closed this as completed Mar 8, 2018
@michaelmillar
Copy link
Contributor Author

Yes the 3.2 container sets up without error on docker compose up

I still get Class MongoClient not found. in my app

@cytopia cytopia reopened this Mar 11, 2018
@cytopia
Copy link
Owner

cytopia commented Mar 11, 2018

Then I was to quick closing this issue. So I will try to reproduce your error on my machine.

Can you tell me what framework you have used and how it is configured (just the base, not the custom part), so i can get it working locally

@michaelmillar
Copy link
Contributor Author

It's Symfony.

The error arises from

   public function __construct($dbname, $dbhost) {

        if (!class_exists('MongoClient')) {
            throw new \Exception('Class MongoClient not found.');
        }

I'm not sure how to say how it is configured but I will edit this answer when I can find out better information on the error.

@cytopia
Copy link
Owner

cytopia commented Mar 12, 2018

It seems you are using a deprecated mongo library version: https://secure.php.net/manual/en/class.mongoclient.php

I try to see if this can be added anyway.

@cytopia
Copy link
Owner

cytopia commented Mar 12, 2018

Will be available after merge: devilbox/docker-php-fpm#5

@michaelmillar
Copy link
Contributor Author

michaelmillar commented Mar 13, 2018

I think this is working now as I have not seen the same Class MongoClient not found. error.

I have some unrelated issues in the Symfony app, like JS not being run (presumably due to permissions errors) but I can try to work through those.

@cytopia
Copy link
Owner

cytopia commented Mar 14, 2018

Feel free to create a new ticket on your permission problems. I actually tried hard to make sure that especially permissions should never be an issue. Let's get this sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants