Вопрос: Две версии PHP на одном сервере. Как установить модули для одной из них?

Лучший ответ:
Дистрибутив и список установленных пакетов в студию.
Узнать дистриб можно из консоли:cat /etc/os-release
список пакетов:sudo dpkg --list | grep php
Пример вывода у меня:alex@SUNDUKOV:~$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="12.04.5 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
VERSION_ID="12.04"
alex@SUNDUKOV:~$ sudo dpkg --list | grep php
ii  dh-php                                      0.23+deb.sury.org~precise+1                             debhelper add-on to handle PHP PECL extensions
ii  dh-php5                                     0.2+deb.sury.org~precise+1                              debhelper add-on to handle PHP PECL extensions
ii  php-common                                  1:45+deb.sury.org~precise+1                             Common files for PHP packages
ii  php-gearman                                 2.0.2+1.1.2-1+deb.sury.org~precise+1                    PHP wrapper to libgearman
ii  php-pear                                    1:1.10.1+submodules+notgz-8+donate.sury.org~precise+2   PEAR Base System
ii  php-xdebug                                  2.5.0-1+deb.sury.org~precise+1                          Xdebug Module for PHP
ii  php-xml                                     1:7.0+45+deb.sury.org~precise+1                         DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php5-cli                                    5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 command-line interpreter for the php5 scripting language
ii  php5-common                                 5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 Common files for packages built from the php5 source
ii  php5-curl                                   5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 CURL module for php5
ii  php5-dev                                    5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 Files for PHP5 module development
ii  php5-fpm                                    5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-json                                   1.3.9-1+deb.sury.org~precise+3                          JSON module for php5
ii  php5-memcache                               3.0.8-5+deb.sury.org~precise+1                          memcache extension module for PHP5
ii  php5-memcached                              2.2.0-2+deb.sury.org~precise+1                          memcached extension module for PHP5, uses libmemcached
ii  php5-mysql                                  5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 MySQL module for php5
ii  php5-readline                               5.5.37+dfsg-1+deprecated+dontuse+deb.sury.org~precise+1 Readline module for php5
ii  php5-redis                                  2.2.7-1+deb.sury.org~precise+1                          PHP extension for interfacing with Redis
ii  php5-xdebug                                 2.3.2-1+deb.sury.org~precise+1                          Xdebug Module for PHP 5
ii  php5.5                                      5.5.38-4+deb.sury.org~precise+1                         server-side, HTML-embedded scripting language (metapackage)
ii  php5.5-cli                                  5.5.38-4+deb.sury.org~precise+1                         command-line interpreter for the PHP scripting language
ii  php5.5-common                               5.5.38-4+deb.sury.org~precise+1                         documentation, examples and common module for PHP
ii  php5.5-dev                                  5.5.38-4+deb.sury.org~precise+1                         Files for PHP5.5 module development
ii  php5.5-fpm                                  5.5.38-4+deb.sury.org~precise+1                         server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5.5-json                                 5.5.38-4+deb.sury.org~precise+1                         JSON module for PHP
ii  php5.5-mbstring                             5.5.38-4+deb.sury.org~precise+1                         MBSTRING module for PHP
ii  php5.5-mysql                                5.5.38-4+deb.sury.org~precise+1                         MySQL module for PHP
ii  php5.5-opcache                              5.5.38-4+deb.sury.org~precise+1                         Zend OpCache module for PHP
ii  php5.5-readline                             5.5.38-4+deb.sury.org~precise+1                         readline module for PHP
ii  php7.0-cli                                  7.0.13-1+deb.sury.org~precise+1                         command-line interpreter for the PHP scripting language
ii  php7.0-common                               7.0.13-1+deb.sury.org~precise+1                         documentation, examples and common module for PHP
ii  php7.0-curl                                 7.0.13-1+deb.sury.org~precise+1                         CURL module for PHP
ii  php7.0-dev                                  7.0.13-1+deb.sury.org~precise+1                         Files for PHP7.0 module development
ii  php7.0-fpm                                  7.0.13-1+deb.sury.org~precise+1                         server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.0-intl                                 7.0.13-1+deb.sury.org~precise+1                         Internationalisation module for PHP
ii  php7.0-json                                 7.0.13-1+deb.sury.org~precise+1                         JSON module for PHP
ii  php7.0-mbstring                             7.0.13-1+deb.sury.org~precise+1                         MBSTRING module for PHP
ii  php7.0-mcrypt                               7.0.13-1+deb.sury.org~precise+1                         libmcrypt module for PHP
ii  php7.0-mysql                                7.0.13-1+deb.sury.org~precise+1                         MySQL module for PHP
ii  php7.0-opcache                              7.0.13-1+deb.sury.org~precise+1                         Zend OpCache module for PHP
ii  php7.0-pgsql                                7.0.13-1+deb.sury.org~precise+1                         PostgreSQL module for PHP
ii  php7.0-readline                             7.0.13-1+deb.sury.org~precise+1                         readline module for PHP
ii  php7.0-xml                                  7.0.13-1+deb.sury.org~precise+1                         DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  pkg-php-tools                               1.21+deb.sury.org~precise+1                             various packaging tools and scripts for PHP packages
соотвественно под версию 7 я ставил так:#apt-get install php7.0-mbstring

Худший ответ:
Модули для PHP 5.x ставятся командой apt-get install php5-module_name. Для PHP 7.0 - apt-get install php7.0-module_name. Эти модули не пересекутся.