OK, so that should be using the domain user’s php.ini, but keep in mind there may be multiple php.ini files (and the link from php.ini might point to the php5 file). Also, there are multiple system-wide php configuration files and locations (php7 is not in /etc, it’s in /etc/opt/rh/rh-php7.0).
One thing I noticed is that because Virtualmin starts from the system php.ini (it copies it over when creating the new virtual server), it has an include directive, so it pulls in configuration from the system (things in /etc/php.d), so opcache would, by default, be pulled in from the system-wide opcache.ini. But, if you’re using php7 you need to modify the php7 configuration files…not the ones in /etc/php.d. The php7 packages on CentOS have their configuration in /etc/opt/rh/rh-php70/php.d.
That said, when I modified /home/domain/etc/php7.0/php.ini I was able to include your example configuration above at the end of the file (after the include that pulls in the system-wide configs) and turn on opcache.enable_cli and it shows up in my phpinfo() page.
So, to be clear and concise:
Edit /home/domain/etc/php7.0/php.ini and add your options near the end of the file (I like to put changes before the “Local Variables” section).
Reload Apache (systemctl reload httpd).
Test. It should Just Work.
As an aside: Other modes use other files (mod_php uses the system-wide php.ini for whichever php version is enabled, php-fpm uses per-domain pool configuration files in /etc/php-fpm.d on CentOS, I don’t know its exact path on Debian/Ubuntu).
i just tried your suggestion on editing the /home/domain/etc/php7.0/php.ini " i ofc changed the domain with the right one " and did systemctl reload httpd . but this warning error still exist.
EDIT: i did notice this in the apache error log file [Thu Aug 31 16:37:14.235004 2017] [authz_core:error] [pid 6779] [client 81...*:63513] AH01630: client denied by server configuration: /home/cloud/public_html/data/.ocdata
Can you check with a file that just has phpinfo() in it? I’d like to know for sure that it’s actually not enabling opcache cli. When I did that, it definitely changed configuration (and I’m testing on a recently installed CentOS 7 system).
local : opcache.blacklist_filename /etc/opt/rh/rh-php70/php.d/opcache*.blacklist | master: /etc/opt/rh/rh-php70/php.d/opcache*.blacklist
opcache.consistency_checks 0 | master: 0
opcache.dups_fix Off | master: Off
opcache.enable On | master: On
opcache.enable_cli On | master: On
everything its complaining about is currently this
No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our documentation.
The PHP OPcache is not properly configured. For better performance we recommend to use following settings in the php.ini:
So, that kinda hints that the app is running under mod_php rather the fcgid. Did you install it using the Virtualmin Install Script for it, or some other way?