php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57555 Apc doesn't work and for CGI cause a 500 Internal server error
Submitted: 2007-03-02 17:52 UTC Modified: 2009-03-22 19:52 UTC
From: pascal at carat-hosting dot com Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 4.4.4 OS: Centos 4.4 x86_64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pascal at carat-hosting dot com
New email:
PHP Version: OS:

 

 [2007-03-02 17:52 UTC] pascal at carat-hosting dot com
Description:
------------
- PHP Version : 4.4.4 (and 5.2.0 as CGI with suPHP)
- Zend Optimiser. 
- APC : 3.0.13
Created with :
  /usr/bin/phpize
  ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config
  make
  make install

No error during installation. apc.so has been created in /usr/lib64/php4/apc.so

APC config is the default one
  extension=apc.so
  apc.enabled=1
  apc.shm_segments=1
  apc.shm_size=128
  apc.ttl=7200
  apc.user_ttl=7200
  apc.num_files_hint=1024
  apc.mmap_file_mask=/tmp/apc.XXXXXX
  apc.enable_cli=1

A phpinfo() show APC as running. 
apc.php shows APC too.

----------------------------------------------
1 - Run php files with php as apache module
It looks like there is no cache. 
Indeed apc.php shows no file as cached !

2 - If we run a php script as CGI
We have some vhosts that run PHP4 as CGI, in this case we have a 500 Internal server Error
In logs the error is

Premature end of script headers: phpinfo.php
[apc-error] apc_mmap: mmap failed: Cannot allocate memory
  

------------------------------------------------

Why it doesn't work (without error) with php as module ?
is it possible to run APC with CGI php ?
Does it work with PHP5.2 ?

Thanks for your help

Pascal


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-02 20:07 UTC] rasmus@php.net
APC works fine with PHP 5.2.

Running it for CGI doesn't make much sense since the cache is going to get destroyed at the end of each request.

For the Apache module case, remove the Zend Optimizer.
 [2007-03-02 21:07 UTC] pascal at carat-hosting dot com
Thanks

APC is it working or not with zend optimiser ? 
Maybe I have to install APC before zend ?
What happens if I need the zend loader ?

About PHP as CGI, what about FastCGI, it makes sense to have a cache system with FastCgi ? 

On the same box we use different PHP
PHP4 as module (90% of use)
PHP4 as CGI and/or PHP5 as CGI

If I understand well the only way to not setup APC for php4 as cgi and php5 as cgi should be to have different php.ini ?

For example
php-cgi.ini --> cgi
php.ini --> module

Right ?

Thanks for your help

Pascal
 [2009-03-22 19:52 UTC] shire@php.net
The allocation error is likely because you're cache size exceeds the size of your compiled source files, so increasing shm_size should help.  But as Rasmus says this doesn't make much sense on CGI as it only lasts for that process' life, and you'll cost more time and memory than you'll save. APC is not compatible with other opcode caches and is likely to have issues with Zend optimizers etc.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 02:01:30 2024 UTC