Skip to main content

Install APC in Linux

First of all you need to download the APC code from the PHP PECL library. So change directory to somewhere like /tmp and then get the latest version like so:

$ wget
This will always get the latest version, and in my case when I installed it just now downloaded APC-3.0.16.tgz like so:

Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 114298 (112K) [application/octet-stream]
Saving to: `APC-3.0.16.tgz'

100%[=====================>] 114,298     97.1K/s   in 1.1s

22:58:43 (97.1 KB/s) - `APC-3.0.16.tgz' saved [114298/114298]
So then you need to extract the files:

$ tar -zxf APC-3.0.16.tgz
and change into the APC directory:

$ cd APC-3.0.16
 The next step is to run the "phpize" command. This requires that you have PHP development package installed. On CentOS this is php-devel (installed by running "yum install php-devel") and it should have a similar name on other Linux distros.

$ phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
You then configure APC, telling it where the executable file php-config is. If you don't know where this is, then do this:

$ whereis php-config
which will return something like:

php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
and then run the configure command like so:

./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config
This will go ahead and do some configuring stuff which will look something like this:

checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking dynamic linker characteristics... GNU/Linux
checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating config.h
Now that configure is done, it's just a matter of running make :

$ make
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
and then make install:

$ make install
Installing shared extensions:     /usr/lib64/php/modules/
and restarting the Apache web server:

/etc/init.d/httpd restart
The APC cache will now be enabled. You can confirm this by creating a script which calls the phpinfo() command and looking for the APC section. It will have been switched on by default by adding a "" line to your /etc/php.ini file, but you may want to add more settings to configure it more. The INSTALL file suggests this (I have put the default values at the end of each line which is what is set if you don't set anything in the php.ini file):

apc.enabled=1                       # default = 1
apc.shm_segments=1                  # default = 1
apc.shm_size=128                    # default = 30
apc.ttl=7200                        # default = 0
apc.user_ttl=7200                   # default = 0
apc.num_files_hint=1024             # default = 1000
apc.mmap_file_mask=/tmp/apc.XXXXXX  # default = no value
apc.enable_cli=1                    # default = 0


Popular posts from this blog

Shell Script to check tomcat status and restart

The below script checks the status of a particular tomcat status and restarts it if the tomcat does not respond....TOMCAT_HOME=/usr/local/tomcat-folder/

is_Running ()

        wget -O - >& /dev/null
 if( test $? -eq 0 ) then
  return 0
  return 1

kill_Hanged_Processes ()
 echo "killing hanged processes......"
 javaProcs=`ps -efl| grep -v grep | grep java`
 if(test ! -z "$javaProcs") then
  echo "nonzero"
  processId=`echo $javaProcs | awk '{ print $2} '`
  echo "$processId"
  kill -9 $processId
stop_Tomcat ()
 echo "shutting down......"

start_Tomcat ()
 echo "starting......"

restart ()
 sleep 10
 sleep 60

send_Mail ()
# script to send simple email
# email subject
SUBJECT=" went down"
# Email To ?
# Em…

Getting access to menu from portlet in liferay

The below code describes the way of accessing menu items from the portlet. Here i have called it from jsp. The best thing about this is you can use the beautiful permission management of menu items of liferay as well without bothering about that. Writing services for fetching menu names from the layout tables will need more codes for permission managements......

Hope this helps.........

* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
<%@ page import="…

Virus f Opyum Team

Symptoms :: 
Several processes running named f or i. 
Network choked
Apache Dead
Unknown entry  * * * * * root f Opyum Team in crontab

Investigate ::
Try to kill the f process and even root will be unable to kill it. Check file named f and i in /etc or /bin or /usr/sbin directory. Try to delete, the file f  will not delete.  Some unknown .jpg files will be there in the same folder. 

Solve :: The root is unable to delete the file f because of the immutable bit in f
To remove it use ses or chattr
Follow the below steps to remove it completely.....

remove the unknown .jpg files in system folders

(kill process f) option k

#ses -i /bin/f
#rm /bin/f
#ses -i /etc/crontab
#vi /etc/crontab (and delete last line)

Precautions ::  In my case the server was hacked bu Brute-force attack
So set a good password with a combination of upper,lower case letters and special characters.

Post your feedback or any issues you may face removing the virus.  Very less number of good threads are there explaining …