Technology Bites

  • Home
  • Tech
    • Software
    • Browsers
    • Google
    • Internet
    • Windows
  • Mobile
    • Android
    • Apple
    • Windows Phone
  • Products
    • Phones
    • Tablets
  • TIP US
You are here: Home / Software / How to install PHP and APC on Ubuntu VPS

How to install PHP and APC on Ubuntu VPS

PHP is the popular language for writing dynamic scripts. Blogging platforms like WordPress, Drupal and several other content management systems are written in PHP. Since we use WordPress we need to install PHP for the site to function.

Installing PHP

Use the following command to install PHP in Ubuntu.

[shell]sudo apt-get install php5 php-pear[/shell]

This will install PHP, to have MySQL support we need to install MySQL module. Use the following command to install php5 with MySQL

[shell]sudo apt-get install php5-mysql[/shell]

Suhosin is a protection system for PHP, that protects PHP application and core against bufferoverflows or format string vulnerabilities. Install Suhosin if you want to add security to PHP installation (Hardened PHP).

[shell]sudo apt-get install php5-suhosin[/shell]

If you plan to use PhpMyAdmin you may have to tweak Suhosin configuration by increasing the values of “suhosin.request.max.vars”.
Look for these settings in this file.

[shell]/etc/php5/conf.d/suhosin.ini[/shell]

You might want to change php.ini values like max_execution_time and memory_limit. use the following command to edit php.ini file

[shell]sudo nano /etc/php5/apache2/php.ini[/shell]

Save php.ini file and restart apache for the changes to take effect.

Installing APC

APC (Alternative PHP Cache) is a PHP accelerator, these extensions improve the performance of applications written in PHP. APC “optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in shared memory.”

Enter the following commands to install APC
[shell]sudo apt-get install php-apc[/shell]

Restart Apache
[shell]sudo /etc/init.d/apache2 restart[/shell]

You have to edit apc.ini file and these lines, first line is must, others are optional. Depending on your blog size you can adjust the apc.shm_size value in the last line, if you have lot of traffic you can increase it to 64 or 100, this value stands for cache memory in MB allocated to APC..

[shell]extension=apc.so
apc.enabled=1
apc.shm_size=30[/shell]

Edit apc.ini file to add above values, use the following command

[shell]sudo nano /etc/php5/conf.d/apc.ini[/shell]

Restart Apache.

You might want to check if APC is installed by using phpinfo().

Other article in this series

Dedicated VPS Server with Linode
Installing Apache webserver on Ubuntu VPS
Useful .htaccess tips and tricks

Share this:

  • Tweet

Related

About Ram

I am a blogger and Technology Enthusiast. I write about software, tech news, gadgets. You can reach me at ram@teknobites.com, follow me on Google+ or on Twitter

« Samsung received 9 million pre orders for Galaxy S III
Pre-Order Samsung Galaxy S III in India, get free Samsung Bluetooth »

Top Posts

  • SMS Enhancer - Pop Up SMS Notifications on Android with Additional Settings
  • Next Generation Calculator for Android (Supports Voice recognition and Plotting Graphs)
  • New Gmail v4.5 for Android starts rolling out
  • Micromax A34 with 3.5-inch display is available for Rs. 4399
  • You can now play Instant Games like Pac-Man on Facebook Messenger
  • YouGetSignal Checks Network Ports and does Reverse IP Lookup
  • Amazon launches Prime Video service in India
  • Internet Explorer 8 to have privacy controls
  • Microsoft launches Skype Lite for India, optimized for slow connections
  • PrintWhatYouLike: Make Any Web Page Printer Friendly

About Us · Archive · Disclaimer & Privacy Policy · TIP US · Copyright © 2025 · Technology Bites