I decided to install APC to speed up the site that I work for. Sadly, I found out that it was already installed and enabled(The developer who first worked on the servers has moved on).

Then I decided to check the usage of it to see if it needs more memory allocated to it or not. This is when I discovered something weird. A simple file with this code:

<?php
    print_r(apc_cache_info());
?>

It would not work when served from apache. I get Error 320 (net::ERR_INVALID_RESPONSE): Unknown error. And there is nothing in the error log. From the cli on the server, it works fine. But it only says that my check_apc.php file is cached(name of the script that I was running).

So it looks like APC has not fully/correctly been set up. Any one know what the problem could be?

Contents of /etc/php.d/apc.ini:

; Enable apc extension module
extension = apc.so
; Options for the apc module
apc.enabled=1
apc.shm_segments=1
apc.optimization=0
apc.shm_size=32
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
apc.cache_by_default=1

The server is running CentOS

Accepted Answer

Has anyone upgraded the version of php on the server since apc.so was created? It may be that apc.so was compiled against a different version of php.

If possible, try re-compiling apc.so against the current version of php. Or if you are using a package manager, try removing the apc package entirely and reinstall it.

Written by Devon
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki