Manuel O Costales's picture

 Hi, I need to enable opcache in your Moodle Instance, but I don't know what
 I have to do. Can I upgrade the system?

Forum: 
Manuel O Costales's picture

I did a quick google for you and Moodle[2] suggests that
opcache can be installed via PECL. Googling that I found instructions on
how to go about that[3]. Note that those instructions include sudo which
won't be required on a TKL instance when you are running as root (so
just ommit the sudo from the start of each line that includes it).

[2] http://docs.moodle.org/26/en/OPcache
[3] http://fideloper.com/install-zend-opcache

The only other option would be to install a newer version of PHP (which
includes it by default). This is generally not recommended...

Regards,
Jeremy Davis
TurnKey Linux

Manuel O Costales's picture

I just installed zend opcache, and when I check the php version I can see my zend cache module activated, but I'm getting an error when I try to visit my platform.

in firefox it says:

The connection was reset

The connection to the server was reset while the page was loading.

  • The site could be temporarily unavailable or too busy. Try again in a few moments.
  • If you are unable to load any pages, check your computer's network connection.
  • If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

in google it says: 

No data received.

 

I tried installing the Zend Guard Loader (using this url http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Z...) but the problem persist.

Please, I need some help asap!

Jeremy Davis's picture

I'm not 100% sure but my suspicion is that perhaps it is conflicting with some other caching mechanism that may have already been enabled. What was the response when you restarted the services?:

service php5-fpm restart
service apache2 restart

Any errors or warnings?
Can you post the output of:

php -v

Also another thing that may be helpful is turning on php error reporting... Have a look at /etc/php5/apache2/php.ini There should be a line that says something along the lines of:

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

Which is probably commented out. Replace that with:

error_reporting = E_ALL

Then restart Apache:

service apache2 restart

Errors should be logged to /var/log/apache2/error.log

Hopefully that will give you some meaningful error which you can google...

Jeremy Davis's picture

Manuel is having issues posting so he emailed me:

I don't have installed php5-fpm, just php5:

service php5-fpm restart
php5-fpm: unrecognized service

service apache2 restart
Restarting web server: apache2 ... waiting .
service apache2 status
Apache2 is running (pid 11299).

This is the output of the php version:

php -v
PHP 5.3.3-7+squeeze19 with Suhosin-Patch (cli) (built: Feb 17 2014 10:10:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

I activated the ability to show all the errors. FYI this is a test server, in the real one we have installed an SSL certificate, I don't know if that have something related with this issue, anyway, here you have the error log of the apache:

cat /var/log/apache2/error.log
[Tue Apr 22 06:25:06 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 06:25:06 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 06:25:06 2014] [notice] Apache/2.2.16 (Debian)
PHP/5.3.3-7+squeeze19 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
configured -- resuming normal operations
[Tue Apr 22 07:12:25 2014] [error] [client 115.239.248.56] File does
not exist: /var/www/moodle/manager
[Tue Apr 22 13:02:54 2014] [notice] caught SIGTERM, shutting down
[Tue Apr 22 13:02:55 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:02:55 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:02:55 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:02:55 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:02:55 2014] [notice] Apache/2.2.16 (Debian)
PHP/5.3.3-7+squeeze19 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
configured -- resuming normal operations
[Tue Apr 22 13:04:01 2014] [notice] caught SIGTERM, shutting down
[Tue Apr 22 13:04:02 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:04:02 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:04:02 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:04:02 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:04:02 2014] [notice] Apache/2.2.16 (Debian)
PHP/5.3.3-7+squeeze19 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
configured -- resuming normal operations
[Tue Apr 22 13:09:06 2014] [notice] caught SIGTERM, shutting down
[Tue Apr 22 13:09:08 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:09:08 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:09:08 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:09:08 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:09:08 2014] [notice] Apache/2.2.16 (Debian)
PHP/5.3.3-7+squeeze19 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
configured -- resuming normal operations
[Tue Apr 22 13:14:59 2014] [notice] caught SIGTERM, shutting down
[Tue Apr 22 13:15:00 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:15:00 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:15:00 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:15:00 2014] [warn] RSA server certificate CommonName
(CN) `dmc.myvirtualed.com' does NOT match server name!?
[Tue Apr 22 13:15:00 2014] [notice] Apache/2.2.16 (Debian)
PHP/5.3.3-7+squeeze19 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
configured -- resuming normal operations

Thanks for your help!

Jeremy Davis's picture

And that has php5.3 which I'm not even sure that it supports opcache...?

I think the best bet is probably to migrate your data to a v13.0 appliance first... TKLBAM would be the go IMO.

In the meantime you can try this if you want (it'll possibly apply to your new server anyway...

TBH I'm not sure whether or not you actually need PHP-FPM to use opcache but all the tutorials I found online seem to use it so I guess that's probably worth a shot...

apt-get update && apt-get install php5-fpm

Restart all your services again and see what happens...

John's picture

"If you are running PHP 5.3 or 5.4 you can safely ignore the Environment Check message about OpCache"

From https://docs.moodle.org/27/en/OPcache

All the best!

Add new comment