php-pecl-apc cli challenges

Support/Development for PHP
johnthomas001
Forum User
Forum User
Posts: 12
Joined: Wed Feb 10, 2010 2:53 pm

php-pecl-apc cli challenges

Unread post by johnthomas001 »

apc via apache works great, but command line interfaces produces PHP Startup errors like this:

CentOS54[root@http-dev etc]# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: undefined symbol: pcre_exec in Unknown on line 0
PHP 5.2.13 (cli) (built: Mar 2 2010 15:56:41)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Can anyone confirm and/or offer suggestions? I tried many things including apc.enable_cli=0.

CentOS54[root@http-dev etc]# rpm -qa | grep php
php-common-5.2.13-1.el5.art
php-snmp-5.2.13-1.el5.art
php-mcrypt-5.2.13-1.el5.art
php-mbstring-5.2.13-1.el5.art
php-pear-1.7.2-2.el5.art
php-pear-DB-1.7.13-1.el5.centos
php-pdo-5.2.13-1.el5.art
php-5.2.13-1.el5.art
php-mysql-5.2.13-1.el5.art
php-devel-5.2.13-1.el5.art
php-imap-5.2.13-1.el5.art
php-pecl-apc-3.1.2-1.el5.art
php-cli-5.2.13-1.el5.art
php-gd-5.2.13-1.el5.art
php-xml-5.2.13-1.el5.art
php-pear-Date-1.4.7-2.el5.centos
BruceLee
Forum Regular
Forum Regular
Posts: 879
Joined: Sat Mar 28, 2009 6:58 pm
Location: Germany

Re: php-pecl-apc cli challenges

Unread post by BruceLee »

try this:
check via php -m if apc.so is compiled in.
if not add this in your php.ini
extension=apc.so
otherwise uncomment it::
;extension=apc.so
arifa
New Forum User
New Forum User
Posts: 2
Joined: Sun Apr 11, 2010 5:54 am

Re: php-pecl-apc cli challenges

Unread post by arifa »

I can confirm this problem in CentOS 5.4 and 5.3.
Something is probably broken in Atomic PHP 5.2.13 build. Before it was OK, AFAIK.
Maybe an old build of php-pecl-apc (from April 2009!) is not compatible with newer pcre from PHP 5.2.13?

Additionally I want to report several random segfaults regarding your APC module, when restarting Apache. When I disabled APC, this problem disappeared in a whole.


Next problem is a conflict of your module php-suhosin-0.9.29-1.el5.art with EPEL module php-suhosin-0.9.29-3.el5 (built for PHP 5.1.6) using yum update. I must manually exclude suhosin everytime, because PHP 5.1.6 module from EPEL wants replace an "older" module from Atomic.


BruceLee: apc.so is not compiled in nor dynamically loaded (see error msg -> "unable to load"). Modules have not their cfg in php.ini, but in many ini files in /etc/php.d/ directory.
One (stupid) workaround may be this:
  • copy php.ini to php-cli.ini
  • copy all lines from /etc/php.d/apc.ini to /etc/php.ini
  • comment all lines in /etc/php.d/apc.ini
It disabled APC for php CLI and enabled it for Apache module.
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: php-pecl-apc cli challenges

Unread post by breun »

I've had lots of Apache segfault problems with php-pecl-apc. I'd like to use it, but had to go back to using PHP eAccelerator.
Lemonbit Internet Dedicated Server Management
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: php-pecl-apc cli challenges

Unread post by breun »

Just updated PHP and APC to the latest packages in atomic for a client. I'm also getting that pcre_exec error message:

Code: Select all

# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/apc.so' - /usr/lib64/php/modules/apc.so: undefined symbol: pcre_exec in Unknown on line 0
PHP 5.2.13 (cli) (built: Mar  2 2010 18:08:48) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
Also looks like APC is not available because of this.
Lemonbit Internet Dedicated Server Management
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: php-pecl-apc cli challenges

Unread post by breun »

It doesn't seem to matter whether apc.enable_cli in /etc/php.d/apc.ini is set to 0 or 1, the "undefined symbol: pcre_exec in Unknown on line 0" warning appears either way. Could this be a bug in the php-pecl-apc package? I have pcre-6.6-2.el5_1.7.x86_64 installed, if that's important in any way (it doesn't seem to be a direct dependency of php-pecl-apc). A client reports that APC does seem to work correctly in apps running with mod_php.
Lemonbit Internet Dedicated Server Management
artrouss
New Forum User
New Forum User
Posts: 1
Joined: Fri May 28, 2010 7:44 am

Re: php-pecl-apc cli challenges

Unread post by artrouss »

I have exactly the same problem. Have find any solution ?
Actually I need apc to be activated even in php-cli... :(
bvbmedia
New Forum User
New Forum User
Posts: 2
Joined: Wed Oct 27, 2010 5:44 pm
Location: the Netherlands

Re: php-pecl-apc cli challenges

Unread post by bvbmedia »

To get it working quickly I recommend to remove php-pecl-apc by running:

yum remove php-pecl-apc -y

Then install APC through Pecl itself by running:

pecl install apc

Don't forget to tune the settings by editing apc.ini:

vi /etc/php.d/apc.ini

Example settings that we use:

extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.optimization=0
apc.shm_size=1024
apc.ttl=0
apc.user_ttl=7200
apc.num_files_hint=0
apc.mmap_file_mask=/tmp/XXXXXX
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=1

Now it should work without any errors.

To see if it's working copy the apc.php to your vhost:

cp /usr/share/pear/apc.php /var/www/www/domain.com/httpdocs/

Now open your favorite browser and point it to:

http://www.domain.com/apc.php

Hopefully you will see amazing cache hit rates.

Enjoy.

Best Regards,

Bas van Beek
Post Reply