Installing and upgrading help

Moodle 3.2 on Red Hat Enterprise Linux

 
Picture of Heiko Schach
Moodle 3.2 on Red Hat Enterprise Linux
Group Core developers

Hello.

Has anyone here successfully updated to Moodle 3.2 on Red Hat Enterprise Linux yet?

We are currently planning our upgrade from Moodle 3.1 to 3.2. Our Moodle currently runs on Red Hat Enterprise Linux Server release 7.3 (Maipo), which comes with Apache 2.4.6 and PHP 5.4.16.
Starting with Moodle 3.2, the minimum requirements for PHP have increased. Minimum PHP version is now 5.6.5, so all RHEL users will need to find a newer PHP from somewhere.

We are aware that there are many third party repos providing newer versions of PHP (Remi, Webtatic, IUS), but our system admins would rather rely on Red Hat's support and get PHP 5.6 from Red Hat Software collections (RHSCL).

So at the moment we are considering two options:
* PHP 5.6 as mod_php (rh-php56-php) with Apache's prefork MPM.
* PHP 5.6 as PHP-FPM (rh-php56-php-fpm) with Apache's event MPM.

Does anyone already have experiences with a similar setup?
We would be especially interested in using PHP-FPM with Apache's event MPM as it is said to perform better.

Any insight would be greatly appreciated.

Regards,
 Heiko

 
Average of ratings: -
Picture of David Paige
Re: Moodle 3.2 on Red Hat Enterprise Linux
 

Heiko,

How timely.  I am in the process of building a moodle server on rhel 7.3 to replace one on Ubuntu which is no longer supported.  I chose to install the 3.1 version because of the php issues you are currently experiencing.

I am having issues with the installation, though.  I'm wondering if you ran into the same issues, and how you resolved them.  I am currently at a dead stop.

I downloaded php-mbstring and php-intl from redhat.  I was able to install soap and xmlrc from the distro release.  However, I can't enable opcache, because I don't have the .so file.  Moodle docs says that for 5.3 and 5.4, it can be safely ignored.  (That is the only server item in the first portion which remains in CHECK.)

Under other checks, it says I am using the Antelope format and must convert to barracuda.  I ran admin/cli/mysql_compressed_rows.php --list, and it says no issues.  Along with that, it says I must enable full unicode (file_per_table and large_prefix).  I can probably enable those in the cfg file, but that would leave two items uncompleted.

The installation won't let me continue until I resolve these issues.


Thank you,

David Paige

 
Average of ratings: -
Picture of Heiko Schach
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Core developers

You can get opcache from the EPEL repository (Extra Packages for Enterprise Linux).
The package name is php-pecl-zendopcache.

As for the database issue, I'm afraid I have no experience with that.

 
Average of ratings: -
Picture of David Paige
Re: Moodle 3.2 on Red Hat Enterprise Linux
 

Thank you for that information.  I was able to find and download the package. It didn't show up in the package list for rhel 7.  I had to search for it by name.  Now I just need to figure out the mariadb issue and I'll be good to go.

 
Average of ratings: -
Picture of Ken Task
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Particularly helpful Moodlers

Since you've said the sysOP wants to use RH only repos, wonder if the SCL is active in your repo list.

Mind checking?

As root user from any location: yum repolist

You should see a reference to RH's SCL.

If not, the repo has been disabled from normal checking, and one has to adjust the yum commands to enable it on the fly.   Check with sysOP.

Could be that you have the opcache.so file but have not told apache/php that it exist.

To check for existence of the opcache.so file as root user located anywhere:

find /usr/lib64/php/modules/ -name opcache.so

If that responds and shows it's there, then do another find:

find /etc/php.d/ -name opcache.ini

If no response, you are missing the opcache.ini file that should be present in /etc/php.d/

There are quite a few settings in a opcache.ini and am hesitant to post one from a CentOS Linux release 7.3.1611 (Core) as there could be a differences (don't have a commercial RHEL 7 to look at).  If worse comes to worse, I can provide out on the web where you could acquire.   Drop me a PM if you want to do that.

However, having said that ...
Heiko is correct it can be installed via pecl.
IF I re-call correctly, that method of install, gave a message at the end about the ini file in /etc/php.d/ and something the OP had to do manually to make sure php knew of the plugin.

Like Heiko, no comment on DB ... have been working on a rebuilt Centos 6 box to Centos 7 using MySQL Community version and am finding the new environment a bit of a learning curve (all those years of CentOS 5 and 6 are burend to brain! :\).

'spirit of sharing', Ken

 
Average of ratings: -
Picture of David Paige
Re: Moodle 3.2 on Red Hat Enterprise Linux
 

This Moodle 3.1.5 stable installation is in a disconnected network.  It has no connection to the Internet, so all updates must be done through sneakernet.

I can download the php54-php-pecl-zendopcache-7.0.4-3.el7.x86_64 from redhat, but I can't install it.  There is a dependency with php(zend-abi).  I can't find any package named zend-abi, or possibly -igbinary.  I have searched the entire drive, and I do not have opcache.so installed.  I suppose I could try and use cpio to see if that file is in the rpm, but it probably won't do me any good.

 
Average of ratings: -
Picture of Ken Task
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Particularly helpful Moodlers

First, have to comment ... no connection to internet???!!!!   Wow ... what good will it do to run a Moodle if it's only available at that location?   Kinda defeats the purpose.   But, different strokes for different folks, but dunno what to say about 'paraniod folks'. :\

Anyhoo ..

See this:

https://www.cyberciti.biz/faq/how-do-i-find-what-dependencies-a-rpm-file-has/

You'd have to find a linux box connected to the internet that had yum/rpm on it.  Install php on it via yum - include the php54-php-pecl-zendopache.

Then use the rpm -qR [packagename] command to find dependencies.

Might have to build a text file that is nothing more than a series of links to the rpm files needed  - call it phprpms.txt

Then, from a linux/mac/or pc that has wget on it, wget the list.

wget -i phprpms.txt

That will bring down the rpms.   Sneakernet those to the server and place into one directory.

Once in place, as root user on the server, and located in the directory where the rpms reside try a global rpm install command using wilcards:

Something like:

rpm -ivh *.rpm

Best of luck.

'spirit of sharing', Ken


 
Average of ratings: -
Picture of Jonathan Champ
Re: Moodle 3.2 on Red Hat Enterprise Linux
 

I strongly recommend PHP 7 because of the significant performance and memory usage benefits. It is available through RedHat SCL as rh-php70


We are using the PHP-FPM with Apache's event MPM setup, with Shibboleth.

 
Average of ratings: Useful (1)
Picture of Heiko Schach
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Core developers
Thanks Jonathan for the valuable information.

So we are definitely going to switch from mod_php to PHP-FPM when upgrading to Moodle 3.2.
As we have a lot of third party plugins, we don't want to go with PHP 7 yet. PHP 5.6 is good enough for now.

So we will install following packages from RHSCL:
rh-php56 rh-php56-php-fpm rh-php56-php-pgsql rh-php56-php-mbstring rh-php56-php-soap rh-php56-php-gd rh-php56-php-xml rh-php56-php-xmlrpc rh-php56-php-intl rh-php56-php-opcache
For using PHP-FPM instead of mod_php we need to edit Apache's conf.d/php.conf
<FilesMatch \.php$>
#   SetHandler application/x-httpd-php
    SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
For this to work, there has to be mod_proxy and mod_proxy_fcgi enabled in conf.modules.d/00-proxy.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
With PHP-FPM, we can now use Apache's event MPM instead of prefork, so we edit Apache's conf.modules.d/00-mpm.conf
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule mpm_event_module modules/mod_mpm_event.so

So far so good. Next thing would be finding appropriate settings for Apache's event MPM and PHP-FPM.

With prefork MPM, we have following settings:
<IfModule prefork.c>
    StartServers            8
    MinSpareServers         5
    MaxSpareServers         20
    ServerLimit             256
    MaxRequestWorkers       256
    MaxConnectionsPerChild  2000
    GracefulShutdownTimeout 5
</IfModule>

Any suggestions on configuring respective settings for event MPM would be greatly appreciated.
Which settings are worth tweaking for performance in php-fpm.conf?
How to make Moodle's cronjobs work with rh-php56?
 
Average of ratings: Useful (1)
Picture of Matteo Scaramuccia
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developers

Hi Heiko,

How to make Moodle's cronjobs work with rh-php56?

do you mean via CLI? Just call source /opt/rh/rh-php56/enable before running the Moodle cron by CLI (php /path/to/moodle/admin/cli/cron.php).

HTH,
Matteo

 
Average of ratings: Useful (2)
Picture of Jonathan Champ
Re: Moodle 3.2 on Red Hat Enterprise Linux
 
Wow Matteo, I'm glad you responded. I'm not using the SCL, so I would have had no idea.

@Heiko: Other than two timeout values for the proxy configuration, I don't know that we adjusted any of the settings from the defaults. We did have to chown all of the moodledata files to the php-fpm user and make sure that the cronjobs were all running as the php-fpm user.
 
Average of ratings: Useful (1)
Picture of Heiko Schach
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Core developers

Thanks Matteo and Jonathan for the valuable information.

@Matteo
I have found some info in the RHSCL documentation and put a line like this in crontab.

scl enable rh-php56 'php /path/to/moodle/admin/cli/cron.php'


@Jonathan, I will have a look into the timeout values.
Any reason for running php-fpm under a separate user?
I just use the defaults in php-fpm.d/www.conf and everything seems to work fine.

user = apache
group = apache


Still looking for a good guide for optimizing Apache and PHP performance. Moodle's performance recommendations mention PHP-FPM and event MPM, but seem to focus more on mod_php with prefork MPM.

I would be especially interested in following settings in Apache event MPM

ServerLimit
StartServers
MinSpareThreads
MaxSpareThreads
ThreadLimit
ThreadsPerChild
MaxRequestWorkers
Timeout

...and PHP-FPM

pm.max_children
pm.start_servers
pm.min_spare_servers
pm.max_spare_servers
pm.max_requests


 
Average of ratings: -
Picture of Jonathan Champ
Re: Moodle 3.2 on Red Hat Enterprise Linux
 

You do not need to use a different user. I was referring to the default configuration for php-fpm from other sources.

 
Average of ratings: -
Picture of Heiko Schach
Re: Moodle 3.2 on Red Hat Enterprise Linux
Group Core developers
Thank you all for your valuable input.

As a follow-up, Moodle 3.2 has been running on RHEL 7 server for two months now and we haven't experienced any problems so far.


We have moved from mod_php to PHP-FPM with Apache Event MPM, using the PHP 5.6 packages from Red Hat Software Collections (RHSCL).

We haven't noticed any deterioration in performance with this PHP-FPM implementation compared to the RHEL 7 default mod_php we had before.

 
Average of ratings: Useful (1)