How-To: PHP-FPM with APC

majdi33

Verified User
Joined
Oct 29, 2011
Messages
35
This How-To guide is based on the following KB guide:
http://help.directadmin.com/item.php?id=400

I had to make few modification because APC-3.1.9 is not compatible with PHP-FPM

I am using PHP-FPM 5.4 in this tutorial, if you are using php-fpm 5.3 replace 54 by 53

Lets start:

cd /usr/local/directadmin/custombuild
wget http://pecl.php.net/get/APC-3.1.13.tgz
tar xvzf APC-3.1.13.tgz
cd APC-3.1.13
/usr/local/php54/bin/phpize54
./configure --with-php-config=/usr/local/php54/bin/php-config54
make
make install
Now you will be presented with a message like this one

Installing shared extensions: /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files: /usr/local/php54/include/php/
Copy your shared extension file and edit php.ini with your favorite text editor

nano /usr/local/php54/lib/php.ini
Look for "extension_dir" (ctrl+w)
now uncomment the line if it is commented and paste your extension directory
it should look like
extension_dir = "/usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525/"
add under it (you can of course modify these values to your need):

extension=apc.so
apc.enabled=1
apc.shm_size=512M
apc.ttl=7200
apc.user_ttl=7200
apc.enable_cli=1
Save and close (ctrl+x)

Now restart PHP-FPM and apache
service php-fpm54 restart
service httpd restart
That's it. I hope it helped.
 
Last edited:

Suurbier

Verified User
Joined
Apr 23, 2007
Messages
246
Thanks for sharing, we've already seen some topics about PHP-FPM and APC, hope this helps!
 
Last edited:

TheVisitors

Verified User
Joined
Mar 21, 2012
Messages
41
Location
Its my world, you all just live here
This How-To guide is based on the following KB guide:
http://help.directadmin.com/item.php?id=400

I had to make few modification because APC-3.1.9 is not compatible with PHP-FPM

I am using PHP-FPM 5.4 in this tutorial, if you are using php-fpm 5.3 replace 54 by 53

Lets start:



Now you will be presented with a message like this one



Copy your shared extension file and edit php.ini with your favorite text editor



Look for "extension_dir" (ctrl+w)
now uncomment the line if it is commented and paste your extension directory
it should look like


add under it (you can of course modify these values to your need):



Save and close (ctrl+x)

Now restart PHP-FPM and apache


That's it. I hope it helped.
3.1.14 was removed because of a memory issue

3.1.13 is what seems to work for now.
 

guidomallee

Verified User
Joined
Jun 7, 2013
Messages
15
With PHP5.5 I get the following message executing phpize55:

Code:
root@server1:/usr/local/directadmin/custombuild/APC-3.1.13# /usr/local/php55/bin/phpize55
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

root@server1:/usr/local/directadmin/custombuild/APC-3.1.13#
Any clues how to fix this?
 

guidomallee

Verified User
Joined
Jun 7, 2013
Messages
15
Ok, so installing the php5-dev package fixed that one. Next issue I have is on executing 'make':

Code:
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c: In function âmy_copy_class_entryâ:
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:755: warning: assignment from incompatible pointer type
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c: In function âapc_copy_class_entry_for_executionâ:
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:1956: warning: assignment from incompatible pointer type
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c: In function âapc_copy_trait_aliasâ:
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2379: error: âzend_trait_aliasâ has no member named âfunctionâ
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2380: error: âzend_trait_aliasâ has no member named âfunctionâ
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2380: error: âzend_trait_aliasâ has no member named âfunctionâ
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c: In function âapc_copy_trait_precedenceâ:
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2416: error: âzend_trait_precedenceâ has no member named âfunctionâ
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2417: error: âzend_trait_precedenceâ has no member named âfunctionâ
/usr/local/directadmin/custombuild/APC-3.1.13/apc_compile.c:2417: error: âzend_trait_precedenceâ has no member named âfunctionâ
make: *** [apc_compile.lo] Error 1
Any clues on this one?
 

oporowiec

New member
Joined
Sep 1, 2015
Messages
2
Can't compile APC

Hello,

I have a problem like this:

[root@test /usr/local/directadmin/custombuild/APC-3.1.13]# make
/bin/sh /usr/local/directadmin/custombuild/APC-3.1.13/libtool --mode=compile cc -I. -I/usr/local/directadmin/custombuild/APC-3.1.13 -DPHP_ATOM_INC -I/usr/local/directadmin/custombuild/APC-3.1.13/include -I/usr/local/directadmin/custombuild/APC-3.1.13/main -I/usr/local/directadmin/custombuild/APC-3.1.13 -I/usr/local/php53/include/php -I/usr/local/php53/include/php/main -I/usr/local/php53/include/php/TSRM -I/usr/local/php53/include/php/Zend -I/usr/local/php53/include/php/ext -I/usr/local/php53/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/directadmin/custombuild/APC-3.1.13/apc.c -o apc.lo
mkdir .libs
cc -I. -I/usr/local/directadmin/custombuild/APC-3.1.13 -DPHP_ATOM_INC -I/usr/local/directadmin/custombuild/APC-3.1.13/include -I/usr/local/directadmin/custombuild/APC-3.1.13/main -I/usr/local/directadmin/custombuild/APC-3.1.13 -I/usr/local/php53/include/php -I/usr/local/php53/include/php/main -I/usr/local/php53/include/php/TSRM -I/usr/local/php53/include/php/Zend -I/usr/local/php53/include/php/ext -I/usr/local/php53/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/directadmin/custombuild/APC-3.1.13/apc.c -fPIC -DPIC -o .libs/apc.o
In file included from /usr/local/directadmin/custombuild/APC-3.1.13/apc.c:45:
/usr/local/php53/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /usr/local/directadmin/custombuild/APC-3.1.13/apc.c:45:
/usr/local/php53/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/php53/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/local/php53/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:449: error: expected specifier-qualifier-list before 'pcre'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c: In function 'apc_regex_compile_array':
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:510: error: 'apc_regex' has no member named 'preg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:510: error: 'apc_regex' has no member named 'preg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:511: error: 'apc_regex' has no member named 'nreg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:511: error: 'apc_regex' has no member named 'nreg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c: In function 'apc_regex_match_array':
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:552: error: 'apc_regex' has no member named 'preg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:552: error: 'apc_regex' has no member named 'preg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:553: error: 'apc_regex' has no member named 'nreg'
/usr/local/directadmin/custombuild/APC-3.1.13/apc.c:553: error: 'apc_regex' has no member named 'nreg'
*** [apc.lo] Error code 1

Stop in /usr/local/directadmin/custombuild/APC-3.1.13.
#

My system:
uname -a
FreeBSD test 9.3-RELEASE FreeBSD 9.3-RELEASE #0 r268512: Thu Jul 10 23:44:39 UTC 2014 root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64

How to solve this?
 
Top