Since I often have to move this site from one box to another, I’ve documented one such migration (to RedHat 9.0 and PHP 4.3.2).
Set up a minimal RedHat install plus the apt package manager. Then install the whole shebang, including development libraries you’ll need to rebuild PHP later:
apt-get install mysql-devel php php-devel aspell-devel imap-devel net-snmp \
net-snmp-devel net-snmp-utils bzip2-devel freetype-devel aspell-devel \
httpd-devel libjpeg-devel libpng-devel pcre-devel postgresql-devel \
unixODBC-devel gd-devel
Installing ming
For some reason the PHP SRPMS I get off Rawhide have a broken (or outdated) ming, so I compile and install it as follows:
cd ming-0.2a
make
make install
make install-static
Upgrading PHP
Get the latest PHP source RPM (from either RedHat Rawhide or Edwin’s), rebuild it (patching the SPEC file dependencies as needed and adding ming to the configure
invocation), and upgrade:
wget http://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/php-4.3.2-7.src.rpm
rpm -ivh php-4.3.2-7.src.rpm
cd /usr/src/redhat/SPECS/
rpmbuild -ba php.spec
# (Resolve build dependency tweaks: aspell-devel >= 0.50.0 -> 0.30.0 if needed)
cd /usr/src/redhat/RPMS/i386
rpm -Uvh php-*
Note: I later grafted Fedora SRPMs onto RedHat 9.0 with minimal changes (e.g. upgrading to PHP 4.3.6 required also updating pcre
to 4.4 via SRPM).
Accelerate It
Install Turck MMCache:
cd ~/Packages
wget http://belnet.dl.sourceforge.net/sourceforge/turck-mmcache/turck-mmcache-2.3.23.tar.gz
cd ../Build
tar -zxvf ../Packages/turck-mmcache-2.3.23.tar.gz
cd turck-mmcache-2.3.23/
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install
Add to /etc/php.ini
:
zend_extension="/usr/lib/php4/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
Secure mySQL
Check mySQL Security. Default RedHat firewall measures are usually enough for the base configuration, but I still follow hardening steps.
Not covered: Apache security tweaks, PHP security tweaks, site layout, etc.