Most developers who hope to move a site to PHP 7 will still have to maintain PHP 5 sites for a long time, requiring the presence of both. However, building either one, even with the `--program-suffix` configuration option still overwrites some files, like phpize and all the headers in ${prefix}/includes/.
It took me a week to solve this problem for myself and everyone else in our company, but I have proper working patches for it now. They have not been submitted as pull requests yet, because I first want to hear what you think of them. Here are the links: https://github.com/coladict/php-src/tree/php5-migration https://github.com/coladict/php-src/tree/php7-migration These change the install destinations like so: ${prefix}/bin/php => ${prefix}/bin/php[5 or 7] ${prefix}/bin/phpize => ${prefix}/bin/php[5 or 7]ize ${prefix}/bin/php-config => ${prefix}/bin/php[5 or 7]-config ${prefix}/bin/php-cgi => ${prefix}/bin/php[5 or 7]-cgi ${prefix}/bin/phpdbg => ${prefix}/bin/php[5 or 7]dbg ${prefix}/bin/phar => ${prefix}/bin/phar[5 or 7] ${prefix}/bin/phar.phar => ${prefix}/bin/phar[5 or 7].phar I have also added a "install-alternatives" make target that creates soft links to the legacy locations. In systems that have "update-alternatives" like Debian, Ubuntu or Fedora it uses it to generate the links, otherwise it falls-back to "ln -s". In addition these both contain fixes for gd, gmp and ldap extensions that fail to build under Ubuntu 16.04. Tested under Docker containers of ubuntu:xenial, fedora and dock0/arch (Archlinux). Additional configure options used when testing: --with-pic --enable-cli --enable-phpdbg --disable-fpm --with-apxs2=no --build=x86_64-linux-gnu --with-layout=GNU I don't know why automatic detection always yields x86_64-unknown-linux-gnu for build under Ubuntu, but that's not particular to PHP. Shared extensions that are also built and loaded without error during the testing: mbstring gd mysqlnd mysqli pdo_mysql curl gettext pgsql pdo_pgsql xmlrpc bz2 xsl enchant interbase pdo_firebird mcrypt pspell gmp ldap readline recode tidy Making separately building mysqlnd work as shared should really come with it's own instructions. I had to use this complicated stuff ./configure --build=x86_64-linux-gnu --with-pic --enable-mysqlnd \ CFLAGS="-I/usr/include/openssl -I$(dirname $(dirname $(pwd))) -DCOMPILE_DL_MYSQLND -DMYSQLND_SSL_SUPPORTED -DMYSQLND_COMPRESSION_WANTED -DMYSQLND_COMPRESSION_ENABLED -DMYSQLND_HAVE_SSL" \ PHP_OPENSSL="/usr/local /usr" --with-libdir=lib/x86_64-linux-gnu Under Fedora that libdir option changes to --with-libdir=lib64