Upgrading Parallels Plesk 9.3 to 9.5 with PHP 5.4 On CentOS 5

Last weekend we planned to update Parallels Plesk Panel from version 9.3 to 9.5 on one of our CentOS 5 servers, but the installer failed telling we shoud remove php54u-cli (from the IUS repo). Why? Fortunately we found out why taking a look at /tmp/autoinstaller3.log. Turns out the updated packages depend on php-cli, which is PHP 5.1.6 on CentOS 5, which is ugly and old and outdated, and we wanted to keep PHP 5.4.

The Plesk installer wanted us to downgrade PHP 5.4 to 5.1! No way, man...

So we gave the installer what it wanted: php-cli. But an empty RPM.

$ sudo yum install rpmdevtools rpm-build
$ rpmdev-setuptree

We need to create a spec file with an empty %files section.

Contents of ~/rpmbuild/SPECS/php-cli.spec:

Name:           php-cli
Version:        5.4.4
Release:        1%{?dist}
Summary:        Dummy package for PSA compatibility
Group:          Applications/Internet
License:        GPL
URL:            http://www.raqlink.com
Requires:       /usr/bin/php-cgi

%description
Dummy package for PSA compatibility

%files

%changelog
* Sun Jul 01 2012 Raqlink 
- Initial version of the package

Remember: never run rpmbuild as root!

$ rpmbuild -bb ~/rpmbuild/SPECS/php-cli.spec
Processing files: php-cli-5.4.4-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
Wrote: ~/rpmbuild/RPMS/x86_64/php-cli-5.4.4-1.x86_64.rpm
$ sudo rpm -ihv ~/rpmbuild/RPMS/x86_64/php-cli-5.4.4-1.x86_64.rpm

And that's it. No more complaints from the Plesk installer :-D