Sunday 15 February 2015

How to use PHP OPCache? -


PHP 5.5 has been released and there is a new code caching module called OPCcheck, but there is no document in it.

For this.

So where is the document for this and how do I use OPEC?

installation

OpCache was compiled by default on PHP5.5 + Although it is disabled by default, in order to start using OpCache in PHP5.5 you must first enable it. To do this, you have to do the following.

Add the following line to your php.ini :

  zend_extension = / full / path / to / opcache.so (nix) zend_extension = Note that when the path is empty, you should wrap it in quotes:  
  Code> zend_extension = "C: \ Program Files \ PHP5.5 \ ext \ php_opcache.dll"   

Also keep in mind that you will find the <"normal" extension Code> Zend_ extension extension instead of the direction, because it affects the actual jade engine (i.e. PHP runs).

Usage

There are currently four functions you can use:

:

The currently used configuration of OpenCash Uses an array that contains all INI settings as well as version information and blacklisted files.

  var_dump (opcache_get_configuration ());   

:

This will return an array with information about the current state of the cache. This information will include things like: State Cash (Enabled, Resumption, Full etc.), Memory Usage, Hit, Miss and some other useful information. It also includes cached script.

  var_dump (opcache_get_status ());   

:

Resets the entire cache, which means that all possible cached scripts will be re-parsed on the next visit.

  opcache_reset ();   

:

rejects a specific cached script, meaning script will be parsed again on next visit.

  opcache_invalidate ('/ path / to / script / to / invalidate.php', is true);   

Maintenance and report

Some GUIs have been created to help maintain OPCB and create useful reports. These tools take advantage of the above functions.

opcacheGUI

Disclaimer I am the author of this project

Features:

  • Opaque status
  • Opaque configuration
  • Open statistics
  • Cached Script overview
  • Cached script invalidation
  • Multilingual
  • Mobile device support
  • Shining graphs

    Screenshots:

    status

     cached-script

     article

     mobile

    URL: < / P>

    opcache-status

    Features:

    • OpCache status
    • OPK configuration
    • Open statistics
    • Cached script overview
    • Single file

      Screenshots:

      status

      URL:

    • OpCache
    • OpCache status
    • OpCache configuration
    • OpCache stats
    • OpCache reset
    • Cached script invalidation
    • Automatic refresh

      Screenshots:

       opcache-gui-overview

      URL:

No comments:

Post a Comment