Koozali.org: home of the SME Server

Nextcloud PHP Version

Offline calisun

  • *
  • 603
  • +0/-0
Nextcloud PHP Version
« on: October 30, 2020, 06:54:54 PM »
I am trying to install an App inside Nextcloud, but it will not install because it says that PHP v7.3+ is required.
I do have PHP Software Collections Contrib installed, is there a way to make NextCloud use PHP 7.3 from there?
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline stefangk

  • 20
  • +0/-0
Re: Nextcloud PHP Version
« Reply #1 on: October 31, 2020, 12:01:12 PM »
Did you try to set PHP-mod version to v. 7.3
Stefan Krastanov

Offline mmccarn

  • *
  • 2,647
  • +10/-0
Re: Nextcloud PHP Version
« Reply #2 on: October 31, 2020, 02:48:59 PM »
The nextcloud contrib seems to have a lot of code that points explicitly to php72.

- the 'nextcloud-update' event rebuilds stuff for php71 and php72, but not php73
- the httpd.conf template fragments have hard-coded entries for php72

I'm working on figuring out what would need changing to switch to php73 (but don't hold your breath...)

Offline mmccarn

  • *
  • 2,647
  • +10/-0
Re: Nextcloud PHP Version
« Reply #3 on: October 31, 2020, 03:48:35 PM »
Here is what I came up with:

Apply template and other changes to use PHP73 with Nextcloud contrib:
Code: [Select]
## Customize the nextcloud portion of the httpd-e-smith templates
##
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

sed 's/php72-nextcloud.sock/php73-nextcloud.sock/' \
 /etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig15nextcloud \
 > /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/68FastCGIConfig15nextcloud

 sed 's/php72-nextcloud.sock/php73-nextcloud.sock/' \
  /etc/e-smith/templates/etc/httpd/conf/httpd.conf/98nextcloud \
  > /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98nextcloud

##
## Switch the nextcloud php-fpm template from creating output only for PHP72
## to creating output for any instance where 'PHP_VERSION' is set by the template.metadata
##
mkdir -p /etc/e-smith/templates-custom/etc/php-fpm.d/www.conf/

sed "s/\$PHP_VERSION eq '72'/\$PHP_VERSION ne ''/" \
  /etc/e-smith/templates/etc/php-fpm.d/www.conf/15Nextcloud \
  > /etc/e-smith/templates-custom/etc/php-fpm.d/www.conf/15Nextcloud

##
## mimic the nextcloud-update event settings for php-72
##
cd /etc/e-smith/events/nextcloud-update/services2adjust
ln -s restart php73-php-fpm

mkdir -p /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php-fpm.d
mkdir -p /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php.d
touch /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php-fpm.d/www.conf
touch /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php.d/20-opcache.ini

##
## Install php modules missing (on my system) from php73
##
yum install php73-php-apcu
yum install php73-php-imagick
yum install php73-php-pecl-zip

##
## activate changes
##
signal-event nextcloud-update

And, to completely undo these changes (if something goes wrong...):
Code: [Select]
'rm' -f /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/68FastCGIConfig15nextcloud
'rm' -f /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/98nextcloud
'rm' -f /etc/e-smith/templates-custom/etc/php-fpm.d/www.conf/15Nextcloud
'rm' -f /etc/e-smith/events/nextcloud-update/services2adjust/php73-php-fpm
'rm' -f /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php-fpm.d/www.conf
'rm' -f /etc/e-smith/events/nextcloud-update/templates2expand/etc/opt/remi/php73/php.d/20-opcache.ini
signal-event nextcloud-update

[edit] correct the list of yum installs
* remove extraneous yum install php73-php-imagic (missing "k")
* correct install for zip (php73-php-pecl-zip instead of php73-php-zip
« Last Edit: November 03, 2020, 12:23:31 AM by mmccarn »

Offline calisun

  • *
  • 603
  • +0/-0
Re: Nextcloud PHP Version
« Reply #4 on: November 02, 2020, 08:01:54 PM »
Hi mmccarn
Thank you very much for creating the script.
But,
When running your script, I get following error message:

No package php73-php-imagic available.
Error: Nothing to do

 I get the same error message for:
yum install php73-php-zip

Other two installed fine:
yum install php73-php-apcu
yum install php73-php-imagick
« Last Edit: November 02, 2020, 08:28:59 PM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline mmccarn

  • *
  • 2,647
  • +10/-0
Re: Nextcloud PHP Version
« Reply #5 on: November 03, 2020, 12:39:01 AM »
Sorry.
I typo'd php73-php-imagick the first time I tried, then copy/pasted from 'history'... You already have the right package installed as the next line installs it (php73-php-imagick).

The zip file is php73-php-pecl-zip, so:
Code: [Select]
yum install php73-php-pecl-zip
I've corrected the original post.

In any case, the objective is to make sure you have the same modules installed for php73 that you had installed for php72.  You can find your installed php72 modules using:
Code: [Select]
rpm -qa php72-*
then compare it to the list you get with
Code: [Select]
rpm -qa php73-*

Offline calisun

  • *
  • 603
  • +0/-0
Re: Nextcloud PHP Version
« Reply #6 on: November 03, 2020, 01:05:46 AM »
SUCCESS!!

Inside NextCloud Admin area, it shows:
PHP Version: 7.3.24

Thank you very much mmccarn
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline calisun

  • *
  • 603
  • +0/-0
Re: Nextcloud PHP Version
« Reply #7 on: November 03, 2020, 02:01:24 AM »
OK, Further questions.
In order to install the app, I also need to upgrade to NextCloud 20
While trying to update, I get following error messages:

Code: [Select]
There are some warnings regarding your setup.

    MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read the documentation page about this.

    The PHP OPcache is not properly configured. For better performance it is recommended to use the following settings in the php.ini:

    opcache.enable=1
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=128
    opcache.save_comments=1
    opcache.revalidate_freq=1

    This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.
        gmp

Not sure how to correct it
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline ReetP

  • *
  • 3,869
  • +5/-0
Re: Nextcloud PHP Version
« Reply #8 on: November 03, 2020, 10:13:36 AM »
The setting will be in your php.ini

I don't believe you can upgrade past 17 on CentOS 6. Can't remember why but dependencies of some sort. Perhaps it was PHP version.

To be honest, time would be better invested on getting it working on v10 as support ends for CentOS6/v9 at the end of the month.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline mmccarn

  • *
  • 2,647
  • +10/-0
Re: Nextcloud PHP Version
« Reply #9 on: November 03, 2020, 12:09:39 PM »
PHP Settings
The php settings need to be applied to the newly activated php73.

There is a template fragment that came with the nextcloud contrib that includes these settings for php72:
/etc/e-smith/templates/etc/opt/remi/php72/php.d/20-opcache.ini/10base

You can copy those settings to php73 like this:
Code: [Select]
mkdir -p /etc/opt/remi/php73/php.d
cp /etc/opt/remi/php72/php.d/20-opcache.ini /etc/opt/remi/php73/php.d/20-opcache.ini
service php73-php-fpm restart


gmp
Code: [Select]
yum install php73-php-gmp

utfmb4 conversion
The Nextcloud notes on enabling utfmb4 indicate that the innodb Barracuda file format is required.

According to the mysql 5.1 release notes, innodb_file_format=barracuda is not supported until v5.1.38.  SME 92 up-to-date is running mysql-5.1.73.

Let me know if you want notes on
* installing mysql55
* moving the nextcloud db from default mysql to mysql55
* reconfiguring nextcloud to use mysql55

Offline mmccarn

  • *
  • 2,647
  • +10/-0
Re: Nextcloud PHP Version
« Reply #10 on: November 04, 2020, 12:36:25 PM »
I was able to upgrade to Nextcloud v20.0.1 on SME 9.2.

My system still complains about needing utfmb4 to support emojis - fixing that would require mysql55 or mysql57.

Details:

* Install SME 9.2

* Install the nextcloud contrib

* Reconfigure nextcloud to use php73 (the first two are links to earlier posts in this topic):
  * Reconfigure NC to use php73
  * copy php72 opcache settings to php73 and install gmp
  * Update /usr/bin/OCC to use php73 (this would need to be repeated after installing an updated version of the nextcloud contrib):
Code: [Select]
sed -i 's/php72/php73/' /usr/bin/OCC
* use the web updater to update to v17.0.10
  * Run post-upgrade database updates listed at Settings -> Overview
Code: [Select]
OCC db:convert-filecache-bigint
* use the web updater to update to v18.0.10
  * The updater failed with an error "Column name "oc_flow_operations.entity" is "NotNull", but has empty string or null as default".
  * I found the solution at https://github.com/nextcloud/server/issues/23174:
Code: [Select]
mysql nextcloud -e "alter table oc_flow_operations add column entity character varying(256) not null;"
OCC upgrade
  * The update indicated that the 'gallery' app was being disabled

* use the web updater to update to v19.0.4
  * Run the post-upgrade database updates listed at Settings -> Overview
Code: [Select]
OCC db:add-missing-indices
OCC db:add-missing-columns

* use the web updater to update to v20.0.1
Note: I was not offered the update to v20.0.1 until I changed the nextcloud update channel from 'stable' to 'beta'

Offline ReetP

  • *
  • 3,869
  • +5/-0
Re: Nextcloud PHP Version
« Reply #11 on: November 04, 2020, 01:12:36 PM »
I was able to upgrade to Nextcloud v20.0.1 on SME 9.2.

Nice job Mike!

I want to try and sort NextCloud on v10 - it needs quite a few changes to work with PHP-FPM.

Time.....  :(
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Jean-Philippe Pialasse

  • *
  • 2,844
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Nextcloud PHP Version
« Reply #12 on: November 05, 2020, 12:58:41 PM »
simply reuse the following patch updating 72 to 73 should do

https://viewvc.koozali.org/smecontribs/rpms/smeserver-nextcloud/contribs9/smeserver-nextcloud-1.1.0.bz10852.php72.patch?revision=1.2&view=markup


speaking of, the nextcloud action script need also update

Offline ReetP

  • *
  • 3,869
  • +5/-0
Re: Nextcloud PHP Version
« Reply #13 on: November 05, 2020, 02:15:14 PM »
I'll do a patch if someone will test
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline calisun

  • *
  • 603
  • +0/-0
Re: Nextcloud PHP Version
« Reply #14 on: November 05, 2020, 11:41:22 PM »
After my system updated to
Nextcloud 19.0.4
I did:
Code: [Select]
OCC db:add-missing-indicesand
Code: [Select]
OCC db:add-missing-columnsand
Code: [Select]
signal-event nextcloud-update
My system did say it is checking for latest version.
After it was done, it still said:

Nextcloud 19.0.4
Your version is up to date.

UPDATE:
I Just noticed your last sentence :)
Note: I was not offered the update to v20.0.1 until I changed the nextcloud update channel from 'stable' to 'beta'

Will try now
« Last Edit: November 05, 2020, 11:58:47 PM by calisun »
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite