Tuesday, November 8, 2016

Cara Pasang OPCACHE di PHP 5.6 Centos Setup Zend OPcache on CentOS 7

1. buka terminal login ke server dengan bitvise sebagai root.
2.
https://www.webfoobar.com/index.php/node/31

http://stackoverflow.com/questions/17224798/how-to-use-php-opcache


Zend OPcache speeds up the execution of PHP codes. How? We know that PHP is an interpreted language where the instructions are written in a script and needs a process to parse/interpret and execute it. Zend OPcache removes the parse/interpret part by compiling the script to directly executed it by the target machine which makes the execution of your PHP application more faster. This article will show how to setup Zend OPcache on CentOS 7.
The following procedures are tested on my Linode server running Centos 7 64-bit Linux distribution.
  1. Install the PHP Zend OPcache:
      
    yum install php-pecl-zendopcache
      
    
  2. Configure Zend OPcache optimized for your PHP application. Edit opcache.ini:
      
    vi /etc/php.d/opcache.ini
      
    
    ... and change the following to:
      
    opcache.revalidate_freq=0
    opcache.validate_timestamps=0 
    opcache.max_accelerated_files=20000
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=16
    opcache.fast_shutdown=1
      
    
    Comment out the line "opcache.validate_timestamps=0" in your development environment.
    To get the "opcache.max_accelerated_files" you may use this:
      
    find . -type f -print | grep php | wc -l
      
    
    Since I'm using Dupal, I added these:
      
    find . -type f -print | grep module | wc -l
    find . -type f -print | grep inc | wc -l
      
    
  3. If you don't want to apply Zend OPcache to your development site you may add its path at opcache-default.blacklist:
      
    vi /etc/php.d/opcache-default.blacklist
      
    
  4. Restart your Apache:
      
    service httpd restart
      
    
  5. You can download the web UI for Zend OPcache status at https://raw.github.com/rlerdorf/opcache-status/master/opcache.php. Make sure that you protect this web UI from prying eyes. untuk lebih baik gunakan https://github.com/PeeHaa/OpCacheGUI , download, upload, edit, termasuk edit karena di run di subdirectory, hilangkan user dan password..
Tags
PHP
Web Optimization