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.
Use the following command to install PHP in Ubuntu.
sudo apt-get install php5 php-pear
This will install PHP, to have MySQL support we need to install MySQL module. Use the following command to install php5 with MySQL
sudo apt-get install php5-mysql
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).
sudo apt-get install php5-suhosin
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.
You might want to change php.ini values like max_execution_time and memory_limit. use the following command to edit php.ini file
sudo nano /etc/php5/apache2/php.ini
Save php.ini file and restart apache for the changes to take effect.
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
sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart
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..
extension=apc.so apc.enabled=1 apc.shm_size=30
Edit apc.ini file to add above values, use the following command
sudo nano /etc/php5/conf.d/apc.ini
You might want to check if APC is installed by using phpinfo().