PHP Support
PHP may be the reason many of you turned to Ruby in the first place, but it certainly has its place and can be installed on your Brightbox alongside your Rails apps quite easily.
The recommended configuration is to use PHP under FastCGI. This gives you control of how many PHP processes to run concurrently, and thus control over how many MySQL connections it can consume.
Additionally, running it under FastCGI is far better under heavy load, and is also the only supported configuration if you want to use PHP with the Apache worker mpm, which generally performs better than the standard prefork mpm.
Install the packages
sudo apt-get update sudo apt-get install apache2-mpm-worker libapache2-mod-fcgid php5-cgi
This will install the packages you need for basic PHP support and immediately force a reload of Apache, interrupting service for a few seconds.
Add the configuration to Apache
Create a file called /etc/apache2/conf.d/php-fastcgi with the following contents:
<IfModule mod_fcgid.c> AddHandler fcgid-script .php DefaultMaxClassProcessCount 4 DefaultInitEnv PHP_FCGI_MAX_REQUESTS 0 DefaultInitEnv PHP_FCGI_CHILDREN 0 FCGIWrapper /usr/bin/php-cgi .php <Files *.php> Options +ExecCGI </Files> </IfModule>
To increase the maximum number of PHP processes (and thus increase the number of MySQL connections that will be consumed) change the line: DefaultMaxClassProcessCount 4
Installing PHP modules
To install a php module, install the package and restart Apache. For example, to add GD support to php:
sudo apt-get install php5-gd sudo /etc/init.d/apache2 restart
MySQL Support
To get PHP working with the MySQL cluster, you need to install the php5-mysql package.
sudo apt-get install php5-mysql sudo /etc/init.d/apache2 restart
PHP Configuration
If you need to make any configuration tweaks to PHP, the config file is /etc/php5/cgi/php.ini and will require normal reload of Apache to take effect:
sudo pico /etc/php5/cgi/php.ini sudo /etc/init.d/apache2 reload
Support
We don't officially support PHP as we're not all PHP experts, but you shouldn't have any problems with it. Our help desk and wiki software are PHP applications and they run perfectly in a Brightbox.
