Running PHP

The Apache 2.2 rpms installed on your Rails Machine are incompatible with the PHP rpms available through yum. However, you can easily install PHP via source.

Note: Installing PHP requires changing Apache’s processing model. If you are planning to run Rails applications on this server, this may have a performance impact during periods of high traffic.

Follow these steps as the deploy user on your server.

sudo su -
service httpd stop

# Edit /etc/sysconfig/httpd and comment out:
#HTTPD=/usr/sbin/httpd.worker

service httpd start
wget http://us.php.net/get/php-5.2.6.tar.gz/from/this/mirror
tar xzvf php-*.tar.gz
cd php-5.*
yum install flex httpd-devel libjpeg-devel libxml2-devel libpng-devel
./configure --with-apxs2=/usr/sbin/apxs --enable-xml --with-mysql --with-iconv --with-zlib --disable-magic-quotes --with-jpeg --with-jpeg-dir=/usr --with-gd
#if you are on a 64-bit machine, add --with-libdir=/lib64 to your configure line
make && make install 

# Edit /etc/httpd/conf/httpd.conf and under <IfModule mime_module> add this line:
AddType application/x-httpd-php .php .phtml

service httpd restart

That’s it!

Meta