When compiling PHP extensions from source on RHEL 5, you'll typically need these fundamental packages:
php-devel
(contains phpize)autoconf
(version 2.59 or later)automake
(version 1.9 or later)libtool
gcc
and related build tools
RHEL 5's default repositories are outdated. You'll need to enable EPEL and possibly other repos:
# For 64-bit systems:
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5*.rpm
# For i386 systems:
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5*.rpm
If repository installations fail, here's how to build from source:
# Install dependencies
yum install gcc make perl-Digest-SHA
# Download and install autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local
make
make install
# Download and install automake
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
tar xzf automake-1.15.tar.gz
cd automake-1.15
./configure --prefix=/usr/local
make
make install
With the tools installed, here's how to compile uploadprogress:
# Install PHP development package
yum install php-devel
# Download and prepare the extension
pecl download uploadprogress
tar xzf uploadprogress-*.tgz
cd uploadprogress-*
# Build the extension
phpize
./configure
make
make install
# Enable the extension
echo "extension=uploadprogress.so" > /etc/php.d/uploadprogress.ini
service httpd restart
If you encounter version conflicts:
- Check
/usr/local/bin
is in your PATH before/usr/bin
- Verify versions with
autoconf --version
andautomake --version
- For PHP version mismatches, ensure php-devel matches your PHP version
For Rackspace Cloud specific issues, their modified kernel might require additional headers:
yum install kernel-devel-$(uname -r)
When working with older RHEL 5 systems (especially in cloud environments like Rackspace), installing development tools can be particularly challenging. The default repositories often lack critical packages needed for PHP extension compilation.
First, let's add the EPEL repository which contains many additional packages:
# As root:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh epel-release-latest-5.noarch.rpm
Now install the required development tools:
yum install php-devel automake autoconf libtool gcc make
If packages aren't available through yum, you may need to compile from source. Here's how to build autoconf:
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local
make
make install
After installation, verify all components are properly installed:
phpize --version
autoconf --version
automake --version
With dependencies resolved, you can now compile your PHP extension:
pecl install uploadprogress
Or manually:
git clone https://github.com/php/pecl-php-uploadprogress.git
cd pecl-php-uploadprogress
phpize
./configure
make
make install
If you encounter library path issues, try setting these before compilation:
export PHP_PREFIX="/usr"
export PATH=$PHP_PREFIX/bin:$PATH
export PKG_CONFIG_PATH=$PHP_PREFIX/lib/pkgconfig
For complex environments, consider using Docker to avoid dependency issues:
docker run -it centos:5 /bin/bash
# Then follow the same installation steps
Don't forget to add the extension to php.ini:
echo "extension=uploadprogress.so" >> /etc/php.d/uploadprogress.ini
service httpd restart