Quantcast
Channel: performance – 23Systems
Viewing all articles
Browse latest Browse all 4

Installing Alterative PHP Cache (APC) with Plesk on Ubuntu

$
0
0
Parallels Plesk
Parallels Plesk
Ubuntu Linux
Ubuntu Linux

Alternative PHP Cache (APC) is a PHP accelerator. PHP accelerators are extensions built to increase the performance and decrease the load time of software applications written using the PHP programming language. Most PHP accelerators work by caching the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request. A PHP accelerator typically reduces server load and increases the speed of PHP code anywhere from 2-10 times.

APC is a free, open source accelerator that optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in shared memory.

This should improve performance on both physical and virtual hosted machines. These instructions are aimed at Plesk users but should be easily adapted to any Debian based installation.

To install APC the first course of action you will need to take is enter the following command on your server:

sudo apt-get install php-pear php5-dev gcc apache2-threaded-dev

Once that has completed you should be able to run the following:

pecl install apc

You should see something like this:

downloading APC-3.0.19.tgz ...
Starting to download APC-3.0.19.tgz (115,735 bytes)
.........................done: 115,735 bytes
47 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
1. Use apxs to set compile flags (if using APC with Apache)? : yes

1-1, 'all', 'abort', or Enter to continue:

Hit Enter

Next you will need to enable the extension, use vi or nano or whatever your favorite text editor for Linux is.

sudo vi /etc/php5/conf.d/apc.ini

At the very minimum you will need to add the follow to the file:

extension=apc.so
apc.enabled=1
apc.shm_size=30

There are numerous options for APC so please see the following http://us3.php.net/manual/en/apc.configuration.php for details

Copy the apc.php file to your website:

sudo cp /usr/share/php/apc.php /var/www/vhosts/domain.tld/httpdocs

Edit the apc.php file and change the default username and password. These must be changed inorder to login to the APC control panel.

sudo vi /var/www/vhosts/domain.tld/httpdocs/apc.php

defaults('ADMIN_USERNAME','apc'); 			// Admin Username
defaults('ADMIN_PASSWORD','password');  	// Admin Password - CHANGE THIS TO ENABLE!!!

After that issue the following command

sudo /etc/init.d/apache2 restart

You should be good to go and APC should be running. To verify got to yourdomain.tld/apc.php.

The post Installing Alterative PHP Cache (APC) with Plesk on Ubuntu appeared first on 23Systems.


Viewing all articles
Browse latest Browse all 4

Trending Articles