1. install build tools:
$ apt-get install build-essential debhelper fakeroot
2. Download sources
$ cd /usr/src
$ apt-get source php5
3. Install dependent packages
$ apt-get build-dep php5
4. Change setting:
$ cd php5-xxx/
$ cd debian/
$ sudo vim rules
find line:
--with-gd=shared,/usr --enable-gd-native-ttf \
replace it with:
--with-gd=shared --enable-gd-native-ttf \
Edit file /usr/src/phpXXX/debian/setup-mysql.sh
# Add "--user=root" to:
# $mysqld > $datadir/run.log 2>&1 &
$mysqld --user=root > $datadir/run.log 2>&1 &
# Add "--user=root" to:
# $mysqld > $datadir/run.log 2>&1 &
$mysqld --user=root > $datadir/run.log 2>&1 &
After this, run this command to start compiling in the php source folder:
$ dpkg-buildpackage -rfakeroot