Koozali.org: home of the SME Server

Configuration of PHP OPCache for nextcloud: how to??

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Configuration of PHP OPCache for nextcloud: how to??
« on: February 18, 2018, 03:18:06 PM »
Hello,

I have installed Nextcloud into an ibay according to the wiki https://wiki.contribs.org/OwnCloud
I have enabled php7.0 for this ibay by https://wiki.contribs.org/PHP_Software_Collections

From its administrative panel, Nextcloud asks for configuring OPCache by putting following into php.ini:
Code: [Select]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

The questions is: which file should be modified to do it?

What I tried:
- As php7.0 is enabled by php-scl, I think that the conf file isn't /etc/php.ini but /etc/opt/remi/php70/php.ini . Is this right?
- If I'm right,  the conf of this file is given by the templates present into /etc/e-smith/templates/opt/remi/php70/root/etc/php.ini .
- Therefore I created the template-custom /etc/e-smith/templates-custom/opt/remi/php70/root/etc/php.ini/100OPCache_nextcloud and I entered the parameter of opcache given by nextcloud into it.
- After reconfiguring the server, /etc/opt/remi/php70/php.ini contains
Code: [Select]
[PHP]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
at its beginning.

Unfortunately, Nextcloud asks further for the configuration of OP Cache => it seems not to be the right way  :?

How to do this in a working way?

Regards
Arnaud
« Last Edit: February 18, 2018, 03:22:18 PM by Arnaud »

Offline ReetP

  • *
  • 3,736
  • +5/-0
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #1 on: February 18, 2018, 11:01:01 PM »
Assuming you are using smeserver-php-scl

You need to adjust the php.ini here:

/opt/remi/php70/root/etc/php.ini

So your template fragment needs to be in:

/etc/e-smith/templates-custom/opt/remi/php70/root/etc/php.ini

I have added a section on the wiki.

https://wiki.contribs.org/PHP_Software_Collections#Custom_Templates
...
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 Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #2 on: February 19, 2018, 09:56:11 PM »
Hi John,

You need to adjust the php.ini here: /opt/remi/php70/root/etc/php.ini
Are you sure?
I don't have any /etc folder in this directory:
Code: [Select]
# ls /opt/remi/php70/root/
bin  boot  dev  home  lib  lib64  media  mnt  opt  proc  root  sbin  selinux  srv  sys  tmp  usr
but I found another php.ini into /etc/opt/remi/php70 (note that the parameters for opcache are at its beginning)
Code: [Select]
# cat /etc/opt/remi/php70/php.ini
;------------------------------------------------------------
; DO NOT MODIFY THIS FILE! It is updated automatically by the
; SME Server software. Instead, modify the source template in
; an /etc/e-smith/templates-custom directory. For more
; information, see http://www.e-smith.org/custom/
;
; copyright (C) 2002 Mitel Networks Corporation
;------------------------------------------------------------

[PHP]
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

engine                                 = On
short_open_tag                         = On;
asp_tags                               = Off
precision                              = 14
y2k_compliance                         = Off
output_buffering                       = Off
...........



Quote from: ReetP
So your template fragment needs to be in:

/etc/e-smith/templates-custom/opt/remi/php70/root/etc/php.ini
This is the place I put it too,  but of course, if this folder doesn't fit with the place of the conf file......

In the other way, I wonder that the file php.ini placed into /etc/opt/remi/php70 got the parameters set by the template => I'm going to modify the template to get confirmation of this.

Quote from: ReetP
I have added a section on the wiki.
Thanks  :)

Bye
Arnaud

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #3 on: February 19, 2018, 10:15:54 PM »
I confirm:
putting template fragments into the folder /etc/e-smith/templates-custom/opt/remi/php70/root/etc/php.ini/ make them appear into /etc/opt/remi/php70/php.ini after the reconfiguration of the server!

Very strange... :???:

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #4 on: February 20, 2018, 06:00:52 AM »
Arnaud

Quote
Very strange... :???:

Not strange at all.
That is how Koozali SME server works by design, refer
https://wiki.contribs.org/Template_Tutorial

You have been around long enough to know that by now, surely !
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #5 on: February 20, 2018, 05:45:52 PM »
Hint: search for template.metadata

another out of this world example is /etc/smb.conf which expand to /etc/samba/smb.conf

the reasoning for php70 is that previous versions of the scl used to keep the file in /opt rather than in /etc/opt.
It was easier to keep the template path consistant between versions and to use a template metadata to point the right path.

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #6 on: February 20, 2018, 09:43:51 PM »
You have been around long enough to know that by now, surely !
I thought it too..... :-? It is the first time that I'm aware that the paths could be different.... :shock:

Thanks for the hint JPP. It is exactly the chapter that I didn't read, certainly because I hadn't understood that it could be important for me.....Learning every day is nice...

So thinks looks better: I have the right conf file and the right path for the template. I must now find out why nextcloud  claims further for OPcache.

Bye
Arnaud

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #7 on: February 21, 2018, 06:15:05 AM »
Check the values with  phpinfo from the ibay.

Offline Arnaud

  • *
  • 143
  • +0/-0
    • GuedeL
Re: Configuration of PHP OPCache for nextcloud: how to??
« Reply #8 on: February 21, 2018, 09:20:46 PM »
very good idea!

A lot of information (too much for me) and in my case the parameters of opcache (into "Zend OPcache") and the path of the corresponding conf file: /etc/opt/remi/php70/php.d/10-opcache.ini
This file seems not being generated by a template (none found + the direct modifications of the file resist a "signal-event post-upgrade; signal-event reboot"), so I simply entered the parameters wished by nextcloud and it has become happy.  :grin:

Is it the right way to proceed? If "yes" this could/should be added (by me) into the Wiki, or not?

Bye Arnaud