How to install Mongodb PHP extension in Ubuntu 16.04 LTS - mongodb

I'm running Ubuntu 16.04 LTS and I want to use Mongodb with PHP. For this I thought that sudo apt-get install php5-mongo (which is enough for Ubuntu 14.04 LTS) would be enough but I was wrong. I'm getting error like this E: Unable to locate package php5-mongo.
I've just upgraded to Ubuntu 16.04 LTS and want to use mongodb with PHP. Running PHP version is PHP Version 7.0.4-7ubuntu2.
So what can I do to solve this?

I'm afraid you are a bit out of luck at the moment. The current situation is that there are two MongoDB extensions:
"php-mongo", which is the "old" one; This extension supports up to PHP 5.*, but not PHP7. Only bug fixes are planned for it;
"php-mongodb", which is the "new" one; This extension supports PHP5 as well as PHP7;
Now the problem is that the new one is not compatible with the old one, as their whole internals are completely different. Unfortunately there are very few places where examples using the new one's syntax is used, as absolute majority of Mongo-related code is written using the old extension.
As it stands at the moment, if you have moved on to PHP7 your only option is to use the "new" extension, which in turn means that your previous code will stop working.
I've seen couple attempts to create a polyfill for making the migration those two possible (example: https://github.com/alcaeus/mongo-php-adapter), however as I haven't tried it myself I can't tell how well it works.
It seems that this library http://mongodb.github.io/mongo-php-library/ is supposed to cover the gap - after giving it a shot I believe it should cover majority of the "old" functionality without updating code too much.

If some of you are still wondering to use a simple wrapper to the new library as said in this answer: https://stackoverflow.com/a/48086676/2569789
I'm maintaining one for this purpose and you can find it here: https://github.com/ThomasSquall/PHP7MongoDriver
It covers just a few methods at the today's date but I'm going to improve it constantly and I hope would like to contribute too :)

Related

db.listCollections() does not work in mongodb6.0.3

I used mongodb version < 4. Now I needed to install mongodb on ubuntu 22, the easiest way was to install version 6.0.3
But now some of the functionality does not work, for example
db.listCollections()
-There were no problems, but after upgrading to mongodb6.0.3 - it does not work. I read that it is advised to use
db.getCollectionNames()
Are these functions interchangeable? Is there no difference between them?
And is it possible to make db.listCollections() work in version 6.0.3?
I read here that many functions are already outdated in version 5
db.listCollections() was a convenience wrapper in the legacy shell.
To get the same behavior in mongosh, use the listCollections database command, like
db.runCommand("listCollections")

`Haskell` extension for `VSCode` not working on `Linux`

I installed ghcup and:
Stack 2.9.1
HLS 1.8.0
cabal 3.6.2
GHC 9.2.5
All of them are the recommended versions(I verified it using ghcup tui). Then I installed the Haskell extension in VSCode. Unfortunately, it doesn't work. I get syntax highlighting (from the Haskell Syntax Highlighting extension, which seems to be automatically installed alongside the Haskell extension) but there is no Intellisense, no code completion, no error detection and no interactive mode (-->>> evaluation). I experimented with different folders and haskell files. The filetype is correct, because every time I open a .hs file, the Haskell extension checks for updates. I even installed Codium, because I suspected a fault in VSCode, but it was the same there as well.
The hsl language server doesn't seem to be working in Neovim, either. I uninstalled ghcup (ghcup nuke) and reinstalled again. The result is exactly the same. I prepended the PATH and chose vanilla and non-vanilla Stack integration in either installations.
Am I doing something wrong?
OS: Linux Mint on Ubuntu 20.04.1, kernel 5.15.0-56.
After around 10 tries, I managed to fix the problem. It turned out I had three problems:
I had only 12 GB free on my Linux partition, but it seems more are needed. I realised it, when it turned out some haskell-language-server files were missing. I enlarged my Linux partition (something I should have done months ago). The new installation installed all files
The Haskell Language Server HLS was not added to the PATH. I solved it by putting this snippet in ~/.ghcup/config.yaml:
"haskell.serverEnvironment": {
"PATH": "${HOME}/.ghcup/bin:$PATH"
}
The server was now discovered by the Haskell VS Code extension but crashed 5 times and gave up on trying. Restarting it manually didn't help. I opened the logs: View->Output->Haskell and saw the error:
haskell-language-server-wrapper: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by haskell-language-server-wrapper)
It turns out, my Linux Mint distribution uses GLIBC_2.31, not 2.32. This is a very important library, which most applications on the system use. If you are a newbie, it is strongly advised that you DO NOT update it manually.
Instead, what I did, was install a version of the HLS, which used GLIBC_2.31. This problem occured in September and was "fixed" but apparently not very well. There are two options:
download the HLS deb10 version manually (didn't work for me):
ghcup install hls -u https://downloads.haskell.org/~hls/haskell-language-server-1.8.0.0/h
download using ghcup tui HLS version 1.7.0.0 (or whatever newest, which uses your glibc version) and a GHC, which supports that particular version of the HLS (in my case 9.0.2).
I think it's a good idea to preemptively reinstall the extension, in case it used the PATH to configure the HLS, so that its settings are restored to default. It takes up to 20 seconds to initialize the server, so be patient. You can see what's happening in the Output window and verify there are no more errors.
I hope this helps.

Bugzilla - Host upgraded perl - browse/search is the only function failing any way to update just that?

The bugzilla install is very old now (4.0.1) and although it would be best, upgrading is a real pain as I suck at Perl related stuff. It has worked with no issue for many years and stopped in December. On checking the serverhost changed to Perl 5.16.3. Originally it was 5.8.8 and even after 15.10 it worked fine.
The issue I get is very similar to this issue - Bugzilla: bugs are not showing up (show up in DB and everything seems to be fine)
But it is not a template or character problem (the site ran fine with no changes) that I can see and happened the same week the host updated Perl , so I am 99% sure it is Perl related. I am assuming the issue is with either buglist.cgi itself or search pm. Any time I browse or search the Product, component, resolution etc shows "ARRAY and a number. e.g. Product: ARRAY(0x30090f0) Component: ARRAY(0x3993420) Resolution: ARRAY(0x3993378).
The bugzilla is only accessible internally (but hosted by a third-party, so no admin) it only allows user accounts access to search and browse so I cannot demo the issue. Is there a known depreciated Perl command?
Would love to fix but may have to install a new version and import DB, last time it took a few weeks to get running hence looking to avoid that for now.
I had the exact same issue. After digging a little figured this is an issue with the Perl version. In Search.pm, $params->param("field$chart-$row-$col", shift(#$ref)); this line is causing the issue. With 5.8.8 its returning Array object, whereas with 5.16.3 it is returning SCALAR.
My option is to install 5.8.8 and re-install the compatible modules. Or, is there any quick workaround for this?
Update:
Going through the docs, figured that 4.0.10 version of bugzilla has added support for Perl 5.16. Copied the CGI.pm from that and tested.. bugzilla is working. This is a bad hack. But, at least now I know that upgrading to 4.0.10 is another viable solution instead of upgrading Perl.

Making VS Code Remote extension work with GLIBC 2.17 installed in non standard locations

I'm trying to use VSCode Remote extension to connect to a remote host that runs on RHEL/CentOS 6, but it fails to connect since CentOS 6 ships with GLIBC 2.12 and GLIBCXX 3.4.1. As mentioned in this post, in order to get the extension to work, the workaround is to install GLIBC>=2.17 and GLIBCXX>=3.4.18.
Unfortunately, I don't have sudo access for the server, so I won't be able to update these libraries using the bash script provided in the link. Also, in this SO post, the author says not to update the system GLIBC since it can break down system applications. That being said, I've tried something different -- I extracted those rpm packages, as described in this blog, inside my home folder. I've then updated the env variables PATH and LD_LIBRARY_PATH in ~/.bash_profile to point to these new locations. But the node binary (in VS Code Remote) still can't find these libraries.
Is there a way to let the node binary know where to look for these libraries? More precisely, can someone explain how I can make this extension work without sudo access?
I've got it to work by installing gcc and glibc using Linuxbrew. See this post for more details: https://github.com/microsoft/vscode-remote-release/issues/103#issuecomment-546551293.
Couple of things to take note of:
Node binary versions in VS Code Server may vary between commits. In the GitHub comment above, the author uses node#10 -- you may replace it with node#12; everything would still work.
Make sure glibc and gcc are properly installed using linuxbrew. This step is key.

Missing CGAL/hierarchy_simplify_point_set.h file in ubuntu install

I am trying to build some source code on ubuntu 16.04 where one of the classes relies hierarchy_simplify_point_set.h header file, which is part of CGAL's point set package. After following instruction on the installation page, I have installed libcgal-dev and libcgal-qt5-dev via apt-get. The package manager has installed libcgal-dev 4.7 which should include the point set library. However, the particular header file seems to be missing (it seems to have some files from the point set library and not others - I am looking in /usr/include/CGAL). Does anyone know what I am doing wrong?
ps: For good measure, I have already tried uninstalling and reinstalling both the packages, but no luck.
This header has been introduced in CGAL 4.8 while it seems you are using CGAL 4.7.
You can get the latest version of CGAL here. Since the latest versions can be used as a header-only library, simply extract the release archive somewhere and set CGAL_DIR to that location when calling cmake to configure your example and it should work directly.