PHP Velho Oeste 2024

実行時設定

php.ini の設定により動作が変化します。

たいていの場合はデフォルトの APC 設定でうまく動作しますが、 きちんとチューニングをしたい場合は以下のパラメータを設定します。

あなたが決めなければいけないことは、以下の 2 つです。 まず APC にどれくらいの共有メモリを設定するかということ、そして、 ファイルの更新チェックをリクエストのたびに APC が行うかどうかということです。 これらに関連する ini ディレクティブが apc.shm_size および apc.stat です。これらのディレクティブについて、 以下の説明を注意深くお読みください。

サーバーを起動したら、この拡張モジュールに含まれているスクリプト apc.php をドキュメントルート以下に配置し、 ブラウザでアクセスしてください。 キャッシュの状態についての詳細な情報がここで得られます。 PHP で GD が使用可能になっている場合は、きれいなグラフも表示されます。 まず最初にチェックすべきなのは、当然、 実際にファイルがキャッシュされているかどうかでしょう。 実際に動作していることを確認したら、次は左側にある Cache full count の値に注目しましょう。 これは、キャッシュがいっぱいになったために強制削除が行われた (直近の apc.ttl 秒間にアクセスされなかったエントリが、 キャッシュから削除された) 回数を表します。 この値ができるだけ小さくなるようにキャッシュを設定しなければなりません。 キャッシュが絶えずいっぱいになっているようだと、 パフォーマンスに影響を及ぼします。 この場合は、APC に割り当てるメモリの量を増やすか、 キャッシュするスクリプトを絞り込むために apc.filters を使用します。

APC を mmap (メモリマッピング) サポート付きでコンパイルすると、 ひとつのメモリセグメントだけを使うようになります。一方、APC を SHM (SysV 共有メモリ) サポートでビルドした場合は複数のメモリセグメントを使います。 MMAP には、SHM における /proc/sys/kernel/shmmax のような最大値の制限はありません。 一般的には MMAP サポートを推奨します。 ウェブサーバーを再起動するよりも高速にメモリを再利用するし、 起動時のメモリ割り当て量も軽減できるからです。

APC の設定オプション
名前 デフォルト 変更可能 変更履歴
apc.enabled "1" PHP_INI_SYSTEM APC 2 で PHP_INI_SYSTEM。APC <= 3.0.12 で PHP_INI_ALL。
apc.shm_segments "1" PHP_INI_SYSTEM  
apc.shm_size "32M" PHP_INI_SYSTEM  
apc.shm_strings_buffer "4M" PHP_INI_SYSTEM APC 3.1.4 以降で利用可能。
apc.optimization "0" PHP_INI_ALL APC 2 では PHP_INI_SYSTEM。APC 3.0.13 で削除。
apc.num_files_hint "1000" PHP_INI_SYSTEM  
apc.user_entries_hint "4096" PHP_INI_SYSTEM APC 3.0.0 以降で利用可能。
apc.ttl "0" PHP_INI_SYSTEM APC 3.0.0 以降で利用可能。
apc.user_ttl "0" PHP_INI_SYSTEM APC 3.0.0 以降で利用可能。
apc.gc_ttl "3600" PHP_INI_SYSTEM  
apc.cache_by_default "1" PHP_INI_ALL APC <= 3.0.12 で PHP_INI_SYSTEM。APC 3.0.0 以降で利用可能。
apc.filters NULL PHP_INI_SYSTEM  
apc.mmap_file_mask NULL PHP_INI_SYSTEM  
apc.slam_defense "1" PHP_INI_SYSTEM APC 3.0.0 以降で利用可能。APC 3.1.4 より前のバージョンでは、デフォルト値が "0" (無効) でした。
apc.file_update_protection "2" PHP_INI_SYSTEM APC 3.0.6 以降で利用可能。
apc.enable_cli "0" PHP_INI_SYSTEM APC 3.0.7 以降で利用可能。
apc.max_file_size "1M" PHP_INI_SYSTEM APC 3.0.7 以降で利用可能。
apc.use_request_time "1" PHP_INI_ALL APC 3.1.3 以降で利用可能。
apc.stat "1" PHP_INI_SYSTEM APC 3.0.10 以降で利用可能。
apc.write_lock "1" PHP_INI_SYSTEM APC 3.0.11 以降で利用可能。
apc.report_autofilter "0" PHP_INI_SYSTEM APC 3.0.11 以降で利用可能。
apc.serializer "default" PHP_INI_SYSTEM APC 3.1.0 以降で利用可能。
apc.include_once_override "0" PHP_INI_SYSTEM APC 3.0.12 以降で利用可能。
apc.rfc1867 "0" PHP_INI_SYSTEM APC 3.0.13 以降で利用可能。
apc.rfc1867_prefix "upload_" PHP_INI_SYSTEM  
apc.rfc1867_name "APC_UPLOAD_PROGRESS" PHP_INI_SYSTEM  
apc.rfc1867_freq "0" PHP_INI_SYSTEM  
apc.rfc1867_ttl "3600" PHP_INI_SYSTEM APC 3.1.1 以降で利用可能。
apc.localcache "0" PHP_INI_SYSTEM APC 3.0.14 から 3.1.11 で利用可能。
apc.localcache.size "512" PHP_INI_SYSTEM APC 3.0.14 から 3.1.11 で利用可能。
apc.coredump_unmap "0" PHP_INI_SYSTEM APC 3.0.16 以降で利用可能。
apc.stat_ctime "0" PHP_INI_SYSTEM APC 3.0.13 以降で利用可能。
apc.preload_path NULL PHP_INI_SYSTEM APC 3.1.1 以降で利用可能。
apc.file_md5 "0" PHP_INI_SYSTEM APC 3.1.1 以降で利用可能。
apc.canonicalize "1" PHP_INI_SYSTEM APC 3.1.1 以降で利用可能。
apc.lazy_functions 0 PHP_INI_SYSTEM APC 3.1.3 以降で利用可能。
apc.lazy_classes 0 PHP_INI_SYSTEM APC 3.1.3 以降で利用可能。
PHP_INI_* モードの詳細および定義については どこで設定を行うのか を参照してください。

以下に設定ディレクティブに関する 簡単な説明を示します。

apc.enabled boolean

apc.enabled を 0 にすることで APC を無効にできます。 APC が静的にコンパイルされて PHP に組み込まれており、 他に無効にする手段がない場合などに有用です (DSO としてコンパイルされている場合は、 単に php.ini の中の extension という行をコメントアウトするだけで無効にできます)。

apc.shm_segments integer

コンパイラキャッシュのために割り当てる共有メモリセグメントの数。 APC が割り当て済みの共有メモリを使い切ってしまっているが、 すでにシステムが許す限り apc.shm_size を拡大しているといった場合に、この値を大きくすることを試みます。

apc.shm_size string

個々の共有メモリセグメントの大きさを、 この FAQ で説明している記法で指定します。デフォルトで、 共有メモリセグメントの大きさが非常に小さく設定されているシステムもあります (大半の BSD 系システムがこれに含まれます)。

apc.shm_strings_buffer string

APC が内部的に文字列用の共有バッファとして使うためのメモリのサイズ。 最後に M (メガバイト) あるいは G (ギガバイト) をつけなければいけません。 このオプションを有効にすると、PHP-FPM ごとに使うメモリの量を減らせます。 文字列をワーカーごとに格納するのではなく、一括で格納することになるからです。

apc.optimization integer

最適化レベル。ゼロは最適化を無効にし、 値を大きくするほど最適化のレベルが高くなります。 わずかながら速度の向上が期待できます。この項目は実験的なものです。

apc.num_files_hint integer

Web サーバーで読み込まれるソースファイルの総数についての 「ヒント」。よくわからない場合はゼロを指定するか、 単に無視してください。 何千ものソースファイルを扱っているようなサイトで有用です。

apc.user_entries_hint integer

apc.num_files_hint と同様に、 保存するユーザーキャッシュ変数の数についての「ヒント」。 よくわからない場合は、ゼロを設定するか無視してください。

apc.ttl integer

キャッシュされているエントリが、 他のエントリに割り当てられるまでスロットに残っていることの可能な秒数。 ゼロのままにしておくと、キャッシュの中身が古いエントリでいっぱいになってしまい、 新しいエントリがキャッシュできなくなります。 キャッシュが使用可能メモリを超えてしまった場合、 ttl が 0 ならキャッシュを完全に破棄します。 ttl が 0 より大きい場合は、APC は期限切れのエントリの削除を試みます。

apc.user_ttl integer

ユーザーキャッシュエントリが、 他のエントリに割り当てられるまでスロットに残っていることの可能な秒数。 ゼロのままにしておくと、キャッシュの中身が古いエントリでいっぱいになってしまい、 新しいエントリがキャッシュできなくなります。 キャッシュが使用可能メモリを超えてしまった場合、 ttl が 0 ならキャッシュを完全に破棄します。 ttl が 0 より大きい場合は、APC は期限切れのエントリの削除を試みます。

apc.gc_ttl integer

キャッシュエントリがガベージコレクションのリストに残り続ける秒数。 ソースファイルのキャッシュ中にサーバープロセスが死んだ場合の安全装置となります。 ソースファイルが変更された場合、メモリに割り当てられている古いバージョンは、 この TTL に達するまで再読み込みされません。 この機能を無効にするにはゼロを設定します。

apc.cache_by_default boolean

デフォルトで On です。しかし、これを Off にして + で始まる apc.filters とともに使用することで、 フィルタに一致したファイルのみをキャッシュすることが可能です。

apc.filters string

カンマで区切られた、POSIX 拡張正規表現のリスト。 ソースファイル名がいずれかのパターンにマッチした場合、そのファイルはキャッシュされません。 マッチングに使用されるファイル名は include/require に渡される名前であり、 絶対パスではないことに注意しましょう。正規表現が + で始まっている場合、その条件にマッチするファイルはキャッシュされます。 また - で始まっている場合は、 条件にマッチするファイルはキャッシュされません。 デフォルトは - なので、これは省略可能です。

apc.mmap_file_mask string

--enable-mmap を用いて MMAP サポートつきでコンパイルされている場合、ここで mktemp 形式のファイルマスクを指定します。mmap モジュールは、 mmap されたメモリ領域をファイルに置くか共有メモリに置くかを、 これによって判断します。 ファイルベースの mmap を使用するには、この値を /tmp/apc.XXXXXX (正確に 6 つの X)のように指定します。 POSIX 形式の shm_open/mmap を使用するには、.shm をマスクのどこかで指定します。例: /apc.shm.XXXXXX 。 また、/dev/zero を指定することで、カーネルの /dev/zero インターフェイスを使用した anonymous mmap を使用することもできます。未定義の場合は、この方式が用いられます。

apc.slam_defense integer

非常にアクセスの多いサーバーでは、 サーバーを起動したりファイルを書き換えたりするたびに 「多くのプロセスが」「同時に」「同じファイルを」 キャッシュしようとすることになります。このオプションを指定すると、 ある一定のパーセンテージでファイルをキャッシュせずに利用するようにします。 あるいは、単一のプロセスがキャッシュ処理をスキップする確率と考えることもできます。 たとえば、apc.slam_defense75 に設定すると、プロセスがキャッシュされていないファイルをキャッシュする処理を 75% の確率で抑えられます。つまり、この値を大きく設定することで、 キャッシュ処理の混雑を防ぐことが可能です。値を 0 に設定すると、この機能が無効になります。

非推奨です。かわりに apc.write_lock を使用しましょう。

apc.file_update_protection integer

稼動中の Web サーバー上のファイルを書き換える場合、 アトミックな手段で行うべきです。つまり、まずいったん一時ファイルに書き込み、 準備ができた時点でそれをリネーム(mv) して正しい位置に移動します。多くのテキストエディタや cptar その他のプログラムはこの方式ではありません。 ということは、ファイルの書き込み中にそのファイルがアクセスされる (そしてキャッシュされる)可能性があるわけです。 apc.file_update_protection は、 新しいファイルをキャッシュするまでの遅延を設定します。デフォルトは 2 秒で、ファイルの更新時刻(mtime)がアクセス時刻と 2 秒未満しか違わない場合はファイルをキャッシュしないという意味です。 更新の最中のファイルにアクセスしてしまった不幸な人には 変なデータが見えてしまいますが、 少なくともその変な状態がキャッシュされてしまうことはありません。 rsync などのアトミックな更新を保証する方式を利用することがわかっている場合は、 値を 0 に設定することでこの機能を無効にできます。 更新処理に 2 秒以上かかるようなシステムを利用している場合は、 この値をもう少し大きくしたくなるかもしれません。

apc.enable_cli integer

たいていは、テストやデバッグ用に使用します。これを設定すると CLI バージョンの PHP で APC を有効にします。通常は、すべての CLI リクエストに対して APC キャッシュを作成/格納/削除したいとは思わないでしょう。 しかし、CLI バージョンの APC を簡単に作成できるようにしておくことは、 多くのテストシナリオで有用です。

apc.max_file_size integer

この値よも大きなサイズのファイルは、キャッシュされません。 デフォルトは 1M です。

apc.stat integer

この設定を変更する場合は十分注意してください。デフォルト設定は On で、 これは、ファイルが変更されていないかどうかを スクリプトの実行のたびに APC が調べ、 もし変更されていれば、再コンパイルして新しいバージョンをキャッシュします。 この設定を Off にすると、変更されているかどうかがチェックされません。 つまり、変更内容を有効にするには Web サーバーを再起動する必要があるということです。 実運用環境ではコードを変更することはめったにないでしょうから、 この設定を Off にしておくことでパフォーマンスを大きく向上させられます。

include/require されたファイルについてもこのオプションは適用されますが、 もし相対パス (Unix の場合は / で始まらないすべてのパス) の include を使用している場合は、ファイルを一意に識別するために APC がチェックする必要があります。 絶対パスの include を使用している場合、 APC 絶対パスをファイルの識別子として使用し、 チェックを飛ばすことができます。

apc.write_lock boolean

多くの処理が実行されるサーバーでは、最初にサーバーを立ち上げたときや 多くのファイルを変更した場合などに、 すべてのプロセスが同一のファイルをコンパイルしたりキャッシュしたりしてしまうことがあります。 write_lock を有効にすると、ひとつのプロセスのみが 未キャッシュのスクリプトをコンパイルするようになります。 その間、他のプロセスはロック待ちをするのではなく キャッシュされていない状態で実行します。

apc.report_autofilter boolean

バインド時の問題によりキャッシュから自動的に除外されたスクリプトを記録します。

apc.serializer string

APC でサードパーティーのシリアライザーを使うよう設定します。

apc.include_once_override boolean

include_once および require_once を最適化し、コストの高いシステムコールの使用を避けるようにします。

警告

この機能は実験的なものです。 このディレクティブの挙動やディレクティブ名、そして関連するドキュメントなどは、 今後 APC の新バージョンがリリースされるときに予告なく変更される可能性があります。 この機能は自己責任の下で使うようにしましょう。

apc.rfc1867 boolean

RFC1867 のファイルアップロード進捗ハンドラが有効になるのは、 PHP 5.2.0 以降で APC をコンパイルした場合のみです。 これを有効にすると、ファイルアップロードフォームの file フィールドの前に APC_UPLOAD_PROGRESS というフィールドがある場合に APC が自動的にユーザーキャッシュエントリ upload_key を作成します。ここで、key はフォームの APC_UPLOAD_PROGRESS エントリの値となります。

APC_UPLOAD_PROGRESS で指定した hidden フィールドが file フィールドよりも前にこなければならないことに注意しましょう。 そうしないと、アップロードの進捗処理が正しく動作しません。

現時点では、ファイルアップロードの追跡はスレッドセーフではないことに注意しましょう。 前のアップロード処理が終わる前に別のアップロードを開始すると、 前のアップロードの追跡が無効になってしまいます。

rate が使えるのは、 すべてのファイルの転送が完了してからであることに注意しましょう。

例1 apc.rfc1867 の例

<?php
print_r
(apc_fetch("upload_$_POST[APC_UPLOAD_PROGRESS]"));
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [total] => 1142543
    [current] => 1142543
    [rate] => 1828068.8
    [filename] => test
    [name] => file
    [temp_filename] => /tmp/php8F
    [cancel_upload] => 0
    [done] => 1
)

apc.rfc1867_prefix string

rfc1867 のアップロード進捗処理機能で作成するユーザーキャッシュエントリの キーにつけるプレフィックスを指定します。

apc.rfc1867_name string

APC のアップロード進捗処理機能を有効にするフォームの hidden 項目名、そしてユーザーキャッシュエントリのキーのサフィックスを指定します。

apc.rfc1867_freq string

アップロードの進捗を記録するユーザーキャッシュエントリの更新頻度を指定します。 ファイルサイズに対するパーセンテージ、あるいはファイルサイズで指定します。 サイズを指定する場合は、最後に "k""m" あるいは "g" を指定することでそれぞれキロバイト、メガバイト、ギガバイトを指定できます (大文字小文字は区別しません)。 0 を指定すると、可能な限り進捗を更新するようにします。 これは、アップロードの速度を低下させてしまいます。

apc.rfc1867_ttl integer

rfc1867 エントリの TTL

apc.localcache boolean

これは、ロックが不要なローカルプロセスのシャドウキャッシュを有効にします。 これにより、キャッシュが書き込まれる際のロックの競合を軽減します。

apc.localcache.size integer

ローカルプロセスのシャドウキャッシュの大きさ。 ある程度大きなな値を設定しておく必要があります。目安としては apc.num_files_hint の半分程度となります。

apc.coredump_unmap boolean

APC で SIGSEGV のようなシグナルを捕捉し、 シグナルの発生時にコアファイルを書き出せるようにします。 シグナルを受け取ると、 APC は共有メモリセグメントの割り当てを解除し、 コアファイルにそれが書き出されないようにします。 この設定を行うと、 APC の共有メモリセグメントを大きめに設定しているときに 致命的なシグナルを受け取った場合のシステムの安定性が向上します。

警告

この機能には危険性があります。 致命的なシグナルのハンドラで共有メモリセグメントの割り当てを解除しようとすると、 発生したエラーによっては未定義の振る舞いを起こす可能性があります。

注意:

カーネルによってはコアダンプファイルの生成時に共有メモリを無視する機能を持つものもありますが、 そのような実装は、たとえば Apache のスコアボードのような 重要な共有メモリセグメントも無視してしまう可能性があります。

apc.stat_ctime integer

ctime による検証を行えば、svn や rsync といったプログラムが引き起こす問題を回避することができます。 直近の状態から inode が変わっていないことを確実に確かめられるからです。 APC は、通常は mtime のみしか確認しません。

apc.canonicalize bool

オンにすると、no-stat モードのときに相対パスを正規化します。 これを設定すると、ストリームラッパー経由でインクルードしたファイルは キャッシュできなくなります。realpath() はストリームラッパーをサポートしていないからです。

apc.preload_path string

オプションで、ディレクトリへのパスを指定します。 APC の起動時に、ここにあるキャッシュデータを読み込みます。

apc.use_request_time bool

SAPI リクエストの開始時刻を TTL に使用します。

apc.file_md5 bool

ファイルの md5 ハッシュを記録します。

apc.lazy_functions integer

関数の lazy loading を有効にします。

apc.lazy_classes integer

クラスの lazy loading を有効にします。

add a note add a note

User Contributed Notes 11 notes

up
2
bishop
15 years ago
The apc.rfc1867 example code above is a little fast and loose for those running in environments where APC RFC1867 may or may not be available.  This is a little more expressive:

<?php

// if we have PHP and APC
$havePHP = (1 === version_compare(PHP_VERSION, '5.2.0') ? true : false);
$haveAPC = (extension_loaded('apc') && 1 === version_compare(phpversion('apc'), '3.0.13') ? true : false);
if (
$havePHP && $haveAPC) {
   
// if APC and upload tracking is enabled
   
if (ini_get('apc.enabled') && ini_get('apc.rfc1867')) {
       
// get the stats
       
$key = ini_get('apc.rfc1867_prefix') . $_REQUEST['apcid'];
       
$stats = apc_fetch($key);
    }
}

?>
up
2
danbettles at yahoo dot co dot uk
15 years ago
To automatically cache only PHP class files named "<class name>.class.php", add the following lines to php.ini.

apc.cache_by_default = "Off"
apc.filters = "+\.class\.php$"

Notes:
- The regexp is case /sensitive/, so if, say, your project contains filenames with mixed case, you'll need something like "+\.(class|CLASS)\.(php|PHP)$".  I've tried delimiting patterns and using the "i" modifier, but that doesn't seem to work.
- Setting cache_by_default to "On" and applying the positive filter will /not/ work.

If you have more complicated requirements and, like me, you're not familiar with POSIX Extended Regular Expressions (ERE) inparticular, you may find the following link useful.  http://www.regular-expressions.info/refflavors.html
up
1
lamperz at gmail dot com
15 years ago
I'm trying to get upload progress with apc_fetch.
I founded apc_fetch always return false till the upload completed.After fews hours debug, I finally notice that my APC_UPLOAD_PROGRESS was set after the file form.

SO, You should write your form like this
<input type="hidden" id="file_id" name="APC_UPLOAD_PROGRESS" value="blablabla"/>
<input type="file" id="select_file" name="file" value="upload" onchange="parent.test();"/>

the hidden field with name="APC_UPLOAD_PROGRESS" SHOULD be ALWAYS BEFORE input type="file"
up
-1
klaus at hax dot at
10 years ago
Note: If you want to run a script on Windows with apc.enabled=1 as a scheduled task whilst another instance of php is running (like on a webserver) apparently you have to disable apc for this scheduled task, otherwise it will not run and you will have something in your error log like: PHP Fatal error: PHP Startup: apc_shm_create: shmget(0, 33554432, 658) failed: No such file or directory.

So simply execute your scheduled task with:

c:\php\php.exe -d apc.enabled=0 and all will be fine.
up
-1
d_inkubus at yahoo dot com
14 years ago
apc.include_once_override=1 can cause more problems than it solves.  If you're running into weird errors regarding relative paths, make sure this setting is off.  PHP 5.3 already implements most of the speed ups in these calls anyway.
up
-1
fusionstream [a](t) gmail.com
14 years ago
If you are getting 0kb out of 0kb for your upload progress with large files, make sure that upload_max_filesize and post_max_size are larger than the file you are uploading. As far as I can tell, apc.max_file_size does not affect it.
up
-2
neorush at gmail dot com
14 years ago
apc_fetch always returned false.  Turns out that "apc.rfc1867" was set to "0".  I added this line to my php.ini:
apc.rfc1867 = 1
but it could have certainly been changed with ini_set().  That took me way to long to figure out.
up
-2
Will
14 years ago
For anyone wondering why shm_segments is being ignored on their setup, it could be because of the following:

If you've configured APC to use memory mapped files (with the --enable-mmap option), the shm_segments setting is ignored unless you specify a file mask via the mmap_file_mask setting.

This is because APC won't attempt to create multiple anonymous files to map into memory without a mask (since it has no way of naming them sensibly). To set up multiple segments you have to give a file mask so they can be named separately.

apc.mmap_file_mask=/tmp/apc.XXXXXX

Make sure to use exactly 6 "X"s (this is the part that is changed by APC). You can place these files anywhere, they don't have to go in /tmp.

With that said, I'm not sure what the performance impact of having multiple MMAP segments would be. I'm guessing it would probably be negative so you probably don't want to do this.
up
-2
amir w of colnect dot com TIPS
14 years ago
Want to avoid segmentation with apc.shm_segments?If your linux server limits the shared memory block size and you're forced to use apc.shm_segments instead, change the setting by using (here is 512M but change it as you like):
# sysctl -w kernel.shmmax=536870912

(but if you want the change to be permanent after a restart you would have to add the following line in /etc/sysctl.conf

kernel.shmmax=536870912)

and updating apc.ini

apc.shm_segments="1"
apc.shm_size="512"


apc.stat is an extremely important setting for a production server, especially if many files are accessed on every request, which is quite normal on complicated web applications.

Always aspire to use:
apc.stat="0"
so that APC does not try to check that each and every file exists on every request you make. It also means you can update files on your server without crashing incoming requests on that time fragment. Whenever you wish to force APC to re-read all the files, simply clear the cache or restart your server.
up
-3
bas_vijfiwinkel
11 years ago
I took some time to look at the preload_path option.

At the moment of writing the preload_path option is broken because of a bug in the APC source code
which will not allow you to properly preload the cache.

The way to fix it :
Inside 'main_apc.c' in the method called 'static int apc_load_data(const char *data_file TSRMLS_DC)', the length of the key of the value that needs to be stored is determined with the following line :
key_len = strlen(key);
If I am correct this is only the length of the string itself without the null-terminator
However, "_apc_store" seems to want the length of the key string including the terminator.
If I change the line above to :
key_len = strlen(key)+1;
then the preload function works as expected.
You can also notice that 1 character is missing when looking at the user cache entries apc.php. But if you try to use that as a key then APC will not return the contents so that didn't work as a workaround.

If one is able to compile the apc library from source, then one can of course easily fix this option by changing the source code.

Files in the specified path should have the extension '.data'.
The filename itself will become the key for the data that is in that specific file.
The data in the file is a serialized string representing what you want to assign to the specific key. For example s:2:"123" will generate the string "123".
One can only specify 1 value for each key and it should be null-terminated.

It is not possible to preload PHP scripts.
Only values that one retrieved with apc_fetch can be preloaded.
up
-4
amir w of colnect dot com TIPS
14 years ago
apc.stat is an extremely important setting for a production server, especially if many files are accessed on every request, which is quite normal on complicated web applications.

Always aspire to use:
apc.stat="0"
so that APC does not try to check that each and every file exists on every request you make. It also means you can update files on your server without crashing incoming requests on that time fragment. Whenever you wish to force APC to re-read all the files, simply clear the cache or restart your server.
To Top