Koozali.org: home of the SME Server

Obsolete Releases => SME 9.x Contribs => Topic started by: calisun on October 30, 2020, 06:54:54 PM

Title: Nextcloud PHP Version
Post by: calisun 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?
Title: Re: Nextcloud PHP Version
Post by: stefangk on October 31, 2020, 12:01:12 PM
Did you try to set PHP-mod version to v. 7.3
Title: Re: Nextcloud PHP Version
Post by: mmccarn 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...)
Title: Re: Nextcloud PHP Version
Post by: mmccarn 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
Title: Re: Nextcloud PHP Version
Post by: calisun 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
Title: Re: Nextcloud PHP Version
Post by: mmccarn 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-*
Title: Re: Nextcloud PHP Version
Post by: calisun 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
Title: Re: Nextcloud PHP Version
Post by: calisun 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
Title: Re: Nextcloud PHP Version
Post by: ReetP 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.
Title: Re: Nextcloud PHP Version
Post by: mmccarn 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 (https://docs.nextcloud.com/server/16/admin_manual/configuration_database/mysql_4byte_support.html) on enabling utfmb4 indicate that the innodb Barracuda file format is required.

According to the mysql 5.1 release notes (https://downloads.mysql.com/docs/refman-5.1-en.a4.pdf), 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
Title: Re: Nextcloud PHP Version
Post by: mmccarn 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 (https://wiki.contribs.org/Software_Collections:MySQL) or mysql57 (https://wiki.contribs.org/Software_Collections:MySQL57).

Details:

* Install SME 9.2

* Install the nextcloud (https://wiki.contribs.org/Nextcloud) contrib

* Reconfigure nextcloud to use php73 (the first two are links to earlier posts in this topic):
  *  Reconfigure NC to use php73 (https://forums.contribs.org/index.php/topic,54312.msg284141.html#msg284141)
  * copy php72 opcache settings to php73 and install gmp (https://forums.contribs.org/index.php/topic,54312.msg284149.html#msg284149)
  * 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'
Title: Re: Nextcloud PHP Version
Post by: ReetP 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.....  :(
Title: Re: Nextcloud PHP Version
Post by: Jean-Philippe Pialasse 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
Title: Re: Nextcloud PHP Version
Post by: ReetP on November 05, 2020, 02:15:14 PM
I'll do a patch if someone will test
Title: Re: Nextcloud PHP Version
Post by: calisun 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
Title: Re: Nextcloud PHP Version
Post by: calisun on November 06, 2020, 01:27:13 AM
SUCCESS!!
But there was a slight hiccup.
After it completed 1st page of update (Download)
It went to a second page to proceed with update, where it gave me an error message. After error, screen refreshed and I got "Maintenance Mode" screen. It said that the screen will refresh by itself once maintenance is complete, but it was sitting there for over an hour.
So I went to command and issued:
Code: [Select]
signal-event nextcloud-updateAfter that, it was back to normal
Title: Re: Nextcloud PHP Version
Post by: calisun on November 06, 2020, 08:03:29 AM
There was a small issue getting to some of the folders (error message would pop up).
I issued following command, and now everything works:

Code: [Select]
yum install php73-php-smbclient
signal-event nextcloud-update
Title: Re: Nextcloud PHP Version
Post by: TerryF on November 06, 2020, 11:29:03 AM
Good work, worthwhile adding details to wiki for the great unwashed like me :-)