Background
phpredis is one of major library for using redis on PHP. It bundles a shell script to build debian package, so by using this you can easily do package-based server management.
However there’s two problem when you built the package with the script.
Two problems of the debian package built with bundled script
The first problem is that the installation fails because of following reason:
% sudo dpkg -i phpredis-x86_64.deb (Reading database ... 42333 files and directories currently installed.) Unpacking phpredis (from phpredis-x86_64.deb) ... dpkg: error processing phpredis-x86_64.deb (--install): unable to open '/etc/php5/apache2/conf.d/redis.ini.dpkg-new': No such file or directory Errors were encountered while processing: phpredis-x86_64.deb
The second problem is that the target architecture(e.g. amd64, i386) is not specified correctly.
It is specified as ‘any’. So if you have multiple architecture type in your operating servers, it will cause on deployment.
In next section, I explain how to fix there problems.
How to solve
- open ‘mkdeb-apache2.sh’
- Comment below line out
28 dpkg -b debian phpredis-`uname -m`.deb 29 #rm -rf debian/ # comment this line out
- Run it.
% ./mkdeb-apache2.sh
- After running the script, you will get ‘debian’ directory as below:
% ls -l debian/ % ls debian/ DEBIAN/ etc/ usr/
- Make ‘conffiles’ with below command:
% echo "/etc/php5/apache2/conf.d/redis.ini" > debian/DEBIAN/conffiles
- Edit ‘Architecture’ field in ‘debian/DEBIAN/control’ file to your build environment architecture.
Package: phpredis Version: 1.0 Section: web Priority: optional #Architecture: any Architecture: amd64 # edited Essential: no Depends: Pre-Depends: Recommends: php5 Suggests: Installed-Size: Maintainer: Nicolas Favre-Felix [n.favre-felix@owlient.eu] Conflicts: Replaces: Provides: phpredis Description: Redis C extension for PHP5.
- Okay, now you can build again and get a package as you expected with this command!
% dpkg -b debian phpredis-`uname -m`.deb
- Finally you get debian package named like this:
phpredis-x86_64.deb
Hopes this helps.