Installing Solr PHP7-Module in Plesk/Ubuntu Environment

Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Andreas Giesen -
Number of replies: 8

Hi! 

I have a problem setting up Global Search in this environment, maybe someone has solved this already smile 

Moodle 3.1.2

Cloud Server with Plesk 12.5, Ubuntu 14.04, Apache2+Nginx

Moodle running under PHP 7 as installed via Plesk

+ Solr Server 6.2.1 is installed and running (can see Solr Admin on port 8983)

+ Solr Moodle Core is installed


Where I get stuck is installing the PHP module properly

The paths in the instructions are different than with PHP7 in Plesk

Though on the CL the pecl-installation of the module worked out, I cannot find solr.so anywhere. 

In the Plesk-PHP-dirs there is no /cli/conf.d and /apache2/conf.d

There is: /opt/plesk/php/7.0/etc/php.d wich is where the extra ini-files are kept. I added "solr.ini" with extension=solr.so in that directory and restarted apache2

- php info shows no solr-module

- Plesk does not show the module, allowing to activate is via the GUI

- thus Moodle Search Settings don't find the plugin either, of course


Global Search is a killer feature, I would really like to get it to work! smile 

Thanks for any input... 

Average of ratings: -
In reply to Andreas Giesen

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Andreas Giesen -

Further development: 

I found solr.so installed in /usr/lib/php5/20121212/solr.so (even though I followed instructions for PHP 7)

Via Plesk PHP Settings I added to the php.ini:

extension=/usr/lib/php5/20121212/solr.so

Now Plesk sees the module and it is active


Still Moodle does not find the module, unter Settings>Plugins>Search>Solr I get: "The Solr PHP module is not installed"



In reply to Andreas Giesen

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Ken Task -
Picture of Particularly helpful Moodlers

Check the phpinfo link from the Moodle Site Admin menu -> Server -> PHP info

Loaded configuration file should point to the active php.ini for the site.  In other words, you could have added the load line to the wrong php.ini file for your site.

Scan this directory for additional ini files gives a path to what is typically /etc/php.d on Linux systems.

And then below the above, yet another box, for additional ini files parsed (loaded) and it will/should show a solr.ini file there.

The solr.ini file should contain the same path you've provided already to be able to load or you actually have a solr.so in more than one location.

Don't host using Plesk Panel so the above an 'educated guess'.

'spirit of sharing', Ken


In reply to Ken Task

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Andreas Giesen -

/opt/plesk/php/7.0/etc/php.d/solr.ini

exists and is shown as parsed in php info

All ini-settings point to the same so-file with absolute path:

extension=/opt/plesk/php/7.0/lib/php/modules/solr.so


So it should work, but... 

In reply to Andreas Giesen

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Ken Task -
Picture of Particularly helpful Moodlers

So with debugging on, what does that tell ya?

Could be something related to nginx.   Ok, don't mind showing my ignorance ... apache2 + nginx?   Thought nginx is a web server and that one cannot run both apache and nginx on the same port 80.   How about checking other logs of server ... like apache2 or nginx's error log?

On that screen where one checks solr ... I can recall if the paths could not be found, in the box where it would show green an error would appear (CentOS 6 - running apache as mod) thus providing a clue.

'spirit of sharing', Ken

In reply to Ken Task

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Andreas Giesen -

So with debugging on, what does that tell ya?

Set to "Developer" - nothing


Could be something related to nginx.   Ok, don't mind showing my ignorance ... apache2 + nginx?   Thought nginx is a web server and that one cannot run both apache and nginx on the same port 80.   How about checking other logs of server ... like apache2 or nginx's error log?

Nginx is configured as reverse proxy for apache: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache - still apache would deliver the php-stuff. But that means that nginx listens on port 80 and apache listens "to nginx" on 7081 (in my case)

I can't wrap my head around how this could be a problem; but of course it could ;) Is there anything in the php-extension that could cause it to not be loaded if the server does not listen on port 80? 


On that screen where one checks solr ... I can recall if the paths could not be found, in the box where it would show green an error would appear (CentOS 6 - running apache as mod) thus providing a clue.

I am not sure, what you mean with "screen where one checks solr" 

In the Moodle Settings for global search the "red" checks say "no configuration file found" - I would say since the extension is not running and I can't setup Solr in Moodle, that's why. 


I just wanted to have a look at the Solr Admin and found Solr not to be running. Ok, so I have not set up any means of autostarting after a reboot. But I could not start it manually either! So I reinstalled it with the Moodle-setup.sh and for now it is running again. This points to Plesk overriding something, that solr needs to be functional. But what? This is getting more and more complicated instead of better ;) 

But: even when Solr Server is active, the extension still does not load. Though there is some new mention of "Solr" in the php info: 

_SERVER['HTTP_REFERER']https://mydomain.de/admin/settings.php?section=searchsolr


In reply to Andreas Giesen

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Ken Task -
Picture of Particularly helpful Moodlers

Well, I'd say the setup isn't 'vanilla' ... to say the least. l)

So, how bout checking into:

https://github.com/o19s/solr_nginx

or/and

https://groups.google.com/forum/#!topic/ajax-solr/pLtYfm83I98

for some ideas/comparison.

'spirit of sharing', Ken

In reply to Ken Task

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Andreas Giesen -

Thanks for your ideas smile 

Actually the setup kind of is "vanilla" as it was preconfigured that way in the cloud hoster's Ubuntu/Plesk 12.5 image (and I don't think the hoster changed the image). At first i was irritated, too, but then I found the article linked above and decided to not change the setup. 

If it was confirmed that the webserver setup was the problem, I might change it to apache on port 80 without nginx, but I am not quite sure what other consequences that would have with a bunch of live sites on it already. 

For now I see two main unsolved problems: 

1. Solr server getting unusable through plesk resetting certain config files when restarting any service etc. (and I don't know which those are)

2. The PHP Solr Plugin not getting loaded even though it looks configured the right way through Plesk (which ensures the system really uses them and the setup stays put after any reset as opposed to trying to change some ini-files directly on the server that are "guarded" by Plesk)

(An example: I installed Moodle via Plesk apps at first and changed stuff in the moodle config file on the server, like the moodledata location above httpdocs, but on every change in Plesk it would reset that file. So I had to "free" Moodle from Plesk by: 1. copying the database 2. copying the file structure 3. deleting the app in plesk 4. reconfigure Moodle to the new database etc. Problem is that Plesk neither warns nor tells about when, what and where things are reset.) 

Back to your ideas: I am not sure if configuring Nginx as a proxy for solr and having nginx as a proxy in the basic setup are the same thing. At the github repo it says it is about securing Solr. But the deeper I get in to this, the more I get lost (for now). At the moment I tend to stop the project "global search" for now and reincheck later. 

In reply to Andreas Giesen

Re: Installing Solr PHP7-Module in Plesk/Ubuntu Environment

by Ken Task -
Picture of Particularly helpful Moodlers

So it's 'vanilla' for your hosting provider ... not 'vanilla' for all hosting providers.  Ubuntu has been known to have worked with hosting providers and provide a special config/setup for the hosting provider (it's been rumored that Ubuntu on Amazon is such).

Confess don't run anything under Plesk, but sounds like 'big brother' to me. Mentioned .... couldn't put moodledata one level up from 'httpdocs' ... doesn't sound 'vanilla' Ubuntu to me either.  Do you have any controls over Plesk and it's config?

As far as location of moodledata ... where is the location of cgi-bin diretory? or icons directory?  With apache, those are normally present although not configured to be used on more 'vanilla' apache configs the directory in which they reside is accessible by 'apache' user/group on other systems.  Document root typically has a 'home' directory (not by that name but on your system that appears to be 'httpdocs') but where is apache user's 'home'?

Am not criticizing hosting provider but wonder if they have their own FAQ's/customer docs for apps like Moodle that have some a-typical requirements?

Yes, setting up search with solr is proving to be interesting on various platforms.  But like you said, it's worth the effort (with conditions).  Maybe one of my 'nobbie' questions/comments concerning setup will trigger viewing the issue with different approach and lead to your solution.

'spirit of sharing', Ken