APC installation troubleshooting

php-apcAPC stands for “Alternative PHP Cache”. APC is a free, open, and robust framework for caching and optimizing PHP intermediate code. This article shows common problems when installing APC and how to fix them.

  1. Installing is as simple as
    [[email protected] ~]# pecl install apc
    [[email protected] ~]# echo "extension=apc.so" >  /etc/php.d/apc.ini
  2. pcre.h: No such file or directory when installing APC (PHP extension)

    1. Error is as follows:
      /usr/include/php5/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
    2. To fix:
      yum install pcre-devel
  3. Cannot execute on /tmp
    1. Error is as follows:
      shtool at '/tmp/APC/build/shtool' does not exist or is not executable. 
      Make sure that the file exists and is executable and then rerun this script.
    2. To fix: allow exec, and then disallow this permission on /tmp after installation
      mount -o remount,exec /tmp
      ....
      mount -o remount,noexec /tmp
  4. sh: phpize: command not found
    1. yum install php-devel
  5. no acceptable C compiler found in $PATH
    1. yum install gcc
  6. Error related to specifier-qualifier-list before ‘pcre’:
    /var/tmp/APC/apc.c:449: error: expected specifier-qualifier-list before ‘pcre’
    /var/tmp/APC/apc.c: In function ‘apc_regex_compile_array’:
    /var/tmp/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
    /var/tmp/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
    /var/tmp/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
    /var/tmp/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
    /var/tmp/APC/apc.c: In function ‘apc_regex_match_array’:
    /var/tmp/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
    /var/tmp/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
    /var/tmp/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
    /var/tmp/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
    1. yum install pcre-devel

Leave a Reply