Install xdebug in Ubuntu 16 with php5 - error: can't read ltmain.sh

Solution 1:

The only supported PHP version in Ubuntu Xenial is 7.0 and php5 packages will be removed before the final release.

However to fix just this bug, you need to fix the ltmain.sh symlink that's included in php5-dev package:

ln -sf /usr/share/libtool/build-aux/ltmain.sh /usr/lib/php5/build/ltmain.sh

Or you can use ppa:ondrej/php5-5.6, that already have that fix and latest upstream version.

Solution 2:

You can also run "apt install php-dev" first before running "pecl install xdebug".

This installs the appropriate dev tools for php7. The answer above is more of a work-around getting a php5 set of dev tools to work with php7.