Adding APC to MediaTemple Grid Service

I have a client that wanted to start his own personal blog. He’s in the IT industry and wanted to use WordPress, he didn’t know what Shared Hosting Provider to go with. I suggested two, dreamhost.com and mediatemple.com

I don’t like shared hosting, why? It’s either slow at time for hours or always slow, so instead I just grab a VPS and pay the $30 or $50 month so my sites load fast. You could even ditch your Grid Service and go with a Dedicated Virtual, and achieve lighting fast page loads on your WordPress/PHP site.

Anyways, lets talk more about how to setup APC properly on the Grid Service. I mean lets really talk about it, because I always forget the steps.

You will need to first download the latest stable version of APC, I’ve had issues with the beta version and the stable version. But far less with the stable version. If you want to pick and choose which version to run visit the APC PECL Website directly at http://pecl.php.net/package/APC

I almost forgot, if you want to follow the instructions in this guide. You will need to have SSH access enabled on your Grid Service account. This guide will assist you.

http://kb.mediatemple.net/questions/16/Connecting+via+SSH+to+your+(gs)+Grid-Service

Once you have access and the URL to the latest stable release of APC (3.0.19 as of this writing). You will want to wget the file to the root of your account.

wget http://pecl.php.net/get/APC-3.0.19.tgz

Decompress and untar the archive, change directory to the extracted contents and phpize the module.

tar -zxvf APC-3.0.19.tgz
cd APC-3.0.19

Next you will want to run phpize. The phpize command prepares the PECL modules build environment.  Once you run phpize you will see something similar to the following:

server@n10:~/APC-3.0.19$ phpize
Configuring for:
PHP Api Version:         20020918
Zend Module Api No:      20020429
Zend Extension Api No:   20050606

Now we want to set the configuration options for the module. You will need to find out what version of PHP your Grid Service is running, you need to know the Major and Minor numbers. You can get this information from phpinfo, you will need to create a new file inside your sites html directory and enter the following:


Make sure the file has a .php extension and then open up a browser and view the file. You should be presented with something like the following.

You can see that we’re running PHP 5.2.14-2, the “-2” is more or less for MediaTemples reference.

Next you want to type out the following command and run it, pay special attention to the “-with-php-config” portion as this is important, make sure you find the right location of this file then run the command.

./configure -enable-apc -enable-apc-mmap -with-apxs2=/usr/sbin/apxs -with-php-config=/usr/local/php-5.2.14-2/bin/php-config

A bunch of text should scroll, hopefully no errors. Now we want to make the module so just type “make”.

xxxxxxx.com@n10:~/APC-3.0.19$ make
/bin/sh /home/xxxxx/users/.home/APC-3.0.19/libtool --mode=compile gcc -I. -I/home/xxxxx/users/.home/APC-3.0.19 -DPHP_ATOM_INC -I/home/xxxxxx/users/.home/APC-3.0.19/include -I/home/113041/users/.home/APC-3.0.19/main -I/home/xxxxxx/users/.home/APC-3.0.19 -I/usr/local/php-5.2.14-2/include/php -I/usr/local/php-5.2.14-2/include/php/main -I/usr/local/php-5.2.14-2/include/php/TSRM -I/usr/local/php-5.2.14-2/include/php/Zend -I/usr/local/php-5.2.14-2/include/php/ext -I/usr/local/php-5.2.14-2/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /home/xxxxxx/users/.home/APC-3.0.19/apc.c -o apc.lo

-------------CUT TO SAVE SPACE--------------

----------------------------------------------------------------------
Libraries have been installed in:
/home/xxxxx/users/.home/APC-3.0.19/modules

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/ld.so.conf'

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

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

Now we just need to make the appropriate directories for the module to reside. The directory you need to find is called “data”, if you follow these steps below you can navigate to the directory. Then make the proper directories, and then copy the module.

cd ~/
cd ../..
cd data
mkdir -p lib/php
cp ~/APC-3.0.19/modules/apc.so

The last step is to modify the php.ini and have PHP load the newly created apc.so module. (Note: in the second example, the ‘xxxx’ stands for your user number, you can find this by running “pwd”)

nano ~/../../etc/php.ini
or
nano /home/xxxx/etc/php.ini

Then just add the following lines:

extension_dir = /home/113041/data/lib/php
extension = apc.so

You should now have APC loaded into PHP, double check by going to the phpinfo page you made and search for APC. It should give you some information and configuration variables. Furthermore, if APC is not being loaded and shown on the phpinfo page, enable the error log (http://wiki.mediatemple.net/w/GS:Read_access_logs_and_error_logs) and see if any error messages are being generated.

Hope you enjoy!


Did you like this article?


0 Shares:
You May Also Like

Western Digital developing 20,000RPM drives

That's right, this isn't a joke.
The new drive will be very similar to the recently-released VelociRaptor, in that it’ll be a 2.5in drive with a custom 3.5in housing built around it. Details are incredibly light at this stage, given that the product is still in development, and we don’t even have a release timeframe at the moment. However, our sources said that the drive will be ‘silent’ – that’s the last thing I would have expected from a drive with platters spinning at 20,000 RPM. Western Digital is apparently working on silencing the beast by improving the housing technology, which will now not just act as a heatsink, but also as a noise cancelling device. We’d also hope that the drive enclosure has some vibration dampening technology as well, because that’s also likely to be a problem given the high spindle speeds.
Now they just need push SATA 6.0Gbit/s onto motherboards http://en.wikipedia.org/wiki/SATA#SATA_6.0_Gbit.2Fs Full artile at bit-tech.net
Read More

Bug Clean up for QuickPwn

Not too long after releasing and updated PwnageTool and Quickpwn, the iphone-dev.org team has released an update to QuickPwn.
We’ve had some issues with iPod touch devices and the latest version of PwnageTool for the Mac, in certain conditions incorrect permissions will be used and the keychain doesn’t save passwords. So hold on and wait for the next release, we’ll push out the updated version via Sparkle as soon as it is tested (it is being tested right now).
Read More

Hard times for hard drives: US may ban popular imports

This could be a damaging blow to quite a few companies within the United States. For instance, take a dedicated server hosting company that relies on one of many hardware vendors like Dell or HP (Hewlett-Packard). Its possible that said vendor will have stock pile of hard drives. Put lets put this into perspective. If you read the entire article you will see a similar situation that ended with Broadcom filing a complaint against Qualcomm. The International Trade Commission banned Qualcomm from shipping any new chips and hardware into the United Sates, and any chips that were already being shipped to the United States could continue. The ban lasted for 45 days, until an appeal by Qualcomm was successful and then the ban was lifted.
Read More

Linksys WRT54G and WRT54GL Being Phased Out?

I went to pick up a Wireless Router from a local computer shop http://www.a-power.com in hopes of grabbing a WRT54GL or at least a WRT54GS. The main reason being that I could flash the hardware to run DD-WRT http://www.dd-wrt.com which is a third part open source router firmware.
Read More