Thank you
@dolomats, but this "tutorial" has some holes, which I would like to fill:
Depending on your operating system, the correct installation for APC would be:
Debian / Ubuntu:
Code:
sudo apt-get install gcc automake php-apc php-pear libpcre3-dev
sudo pecl install apc
CentOS / Redhat / ... :
Code:
yum install gcc automake php-apc php-pear pcre-devel
pecl install apc
During the installation, you will be asked, if you would like to override any existing php.ini with the one from the new package installation and here you stop for a second and think over, if you already modified your php.ini in any way. If this is the case, you sure would like to keep all the changes and therefore should consider answering such questions with NO - if this is not the case, you sure could answer the question with YES.
After the PECL - installation you will see a very necessary information, which looks like this:
Build process completed successfully
Installing '/usr/lib/php5/XXXXXXXXXX/apc.so'
Installing '/usr/include/php5/ext/apc/apc_serializer.h'
install ok: channel://pecl.php.net/APC-X.X.XX
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini
The path with the "/usr/lib/php5/XXXXXXXXXX/apc.so" ( On CentOS it might look like this: "/usr/lib64/php/modules/apc.so" ) various to your very own system configuration and depends on the path, where you installed your PHP - version. Please be aware to either note this information for further references, or look up your very own path on your system, in order to complete the APC - installation with the needed modification to your php.ini 's ( YES.... you have several php.ini' s on a Plesk configured server... please locate your php.ini's with the command "locate php.ini" to find all installed versions and add the modification in all needed ones. )
The needed modification will then look like this:
( for the CLI php.ini at Debian / Ubuntu - please don't forget to locate and modify the other ones as well!, if needed ) :
echo "/usr/lib/php5/XXXXXXXXXX/apc.so" >> /etc/php5/cli/php.ini
echo "apc.enabled=1" >> /etc/php5/cli/php.ini
( for the CLI php.ini at CentOS / Redhat ... - please don't forget to locate and modify the other ones as well!, if needed )
echo "/usr/lib64/php/modules/apc.so" >> /etc/php.ini
echo "apc.enabled=1" >> /etc/php.ini
If you forgot to note where your apc.so is located, please use again the "locate" command:
locate apc.so
If you would like to configure your apc.ini ( the configuration file for APC ) to your very own needs, please locate the apc.ini 's with
"locate apc.ini" and edit the files to your very own modification. They depend again on your system configuration and so it is pretty useless to provide a global apc.ini , but still, here are some defintions, which could be used on systems with
at least 2 GB RAM:
Code:
extension = apc.so
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 512M
apc.optimization = 0
apc.num_files_hint = 4096
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 3600
apc.cache_by_default = 1
apc.filters = ""
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 10M
apc.stat = 0
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
;apc.rfc1867 = 0
;apc.rfc1867_prefix = "upload_"
;apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
;apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 2048
apc.coredump_unmap = 0
apc.stat_ctime = 0
There are many more options for APC, please have a look at the general APC - site for a detailed description:
http://php.net/manual/en/book.apc.php
At the end of your APC - installation there is always the
restart of your webserver(s) and if you use FastCGI, as well php5-fpm. If you would like to administrate APC with the provided "apc.php" page on your webspace, make sure to copy the file apc.php to a secured directory
( either apache-htaccess and/or nginx-htaccess modifications !!! )
cp /usr/share/pear/apc.php /var/www/vhosts/YOUR_DOMAIN.COM/httpdocs/SECURED-DIRECTORY/apc.php
If you are unsure, how to secure a directory in your webspace, please have a look at the Plesk documentation and/or use the Parallels Knowledge Base for issues/failures regarding the correct setup.