PHP APC緩衝

來源:互聯網
上載者:User

標籤:apc

參見官方文檔

http://php.net/manual/en/book.apc.php

The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.


通過以下方式可以查看是否安裝了APC擴充

$ php -r ‘phpinfo();‘ |grep apcapcapc.cache_by_default => On => Onapc.canonicalize => On => Onapc.coredump_unmap => Off => Offapc.enable_cli => Off => Offapc.enabled => On => Onapc.file_md5 => Off => Offapc.file_update_protection => 2 => 2apc.filters => no value => no valueapc.gc_ttl => 3600 => 3600apc.include_once_override => Off => Offapc.lazy_classes => Off => Offapc.lazy_functions => Off => Offapc.max_file_size => 1M => 1Mapc.mmap_file_mask => no value => no valueapc.num_files_hint => 1000 => 1000apc.preload_path => no value => no valueapc.report_autofilter => Off => Offapc.rfc1867 => Off => Offapc.rfc1867_freq => 0 => 0apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESSapc.rfc1867_prefix => upload_ => upload_apc.rfc1867_ttl => 3600 => 3600apc.serializer => default => defaultapc.shm_segments => 1 => 1apc.shm_size => 32M => 32Mapc.shm_strings_buffer => 4M => 4Mapc.slam_defense => On => Onapc.stat => On => Onapc.stat_ctime => Off => Offapc.ttl => 0 => 0apc.use_request_time => On => Onapc.user_entries_hint => 4096 => 4096apc.user_ttl => 0 => 0apc.write_lock => On => On


1.安裝APC擴充


tar -zxvf  APC-3.1.14.tgz

cd APC-3.1.14

phpize 

./configure  --with-php-config=/data/app_platform/php/bin/php-config 

make && make install


2.配置php.ini

以下是建議使用的參數

  extension=apc.so

  apc.enabled=1

  apc.shm_size=128M

  apc.ttl=7200

  apc.user_ttl=7200

  apc.enable_cli=1

3.配置APC參數

參考文檔

http://php.net/manual/en/apc.configuration.php

有兩個首要考慮的問題是:1.給APC分配多少記憶體空間。2.對於每個請求是否讓APC檢查一個檔案是否被更改。這個兩個參數是apc.shm_size和apc.stat

APC內建一個監控頁面apc.php,可以從源碼包中複製apc.php到一個nginx虛擬機器主機,然後通過http://xxxxxx/apc.php查看APC緩衝的狀態。

如果安裝PHP的GD擴充,則可以看到圖表


apc.shm_size        




本文出自 “Linux SA John” 部落格,請務必保留此出處http://john88wang.blog.51cto.com/2165294/1579158

PHP APC緩衝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.