Posts tagged HowTo Install APC on CPanel/WHM

Install APC for PHP on Linux

If you want to install APC for PHP on Linux server then follow the below easy steps :

 [email protected][#] pecl install apc


You can manually install it following the below steps :

[email protected][#] wget

The above command will always downloads the latest version of APC

Now extract the downloaded zip file :

[email protected][#] tar -zxf APC-3.1.9.tgz
[email protected][#] cd APC-3.1.9
Now we need to execute ‘phpize’ command

This requires that you have PHP development package installed. On CentOS it is php-devel and which can be installed by running the command :

 yum install php-devel
[email protected][/usr/local/src/APC-3.1.9]# phpize
 Configuring for:
 PHP Api Version: 20090626
 Zend Module Api No: 20090626
 Zend Extension Api No: 220090626
Now we need to configure APC

If you are unsure as to where the php-configs files are located then use the below command to find the correct path

[email protected][#] whereis php-config

php-config: /usr/bin/php-config /usr/local/bin/php-config /usr/man/man1/php-config.1

and then run the configure command like so:
./configure --enable-apc --enable-apc-mmap --with-apxs 

Now as configure is done, we need to run ‘make’ command:

[email protected][#] make
 and then make install:
 [email protected][#] make install

If everything goes well then you will get an output like this

Build process completed successfully
Installing '/usr/local/include/php/ext/apc/apc_serializer.h'
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/'
install ok: channel://
Extension apc enabled in php.ini

Finally just restart the web server to reflect the changes :

[email protected][#] /etc/init.d/httpd restart

But if you encounter an error as below

error: syntax error before ')' token
make: *** [apc.lo] Error 1

then just execute the below command :

[email protected][#] yum install pcre-devel

After that again try “make” and “make install” commands and it will work for you now.

That’s all you are done.