Here is an easy instruction of how to setup different PHP versions per directories when using mod_lsapi.
Assuming that you already have CageFS, PHP Selector and mod_lsapi installed, perform the following steps:
1. Setup mod_lsapi (no matter globally or per domain).
2. For EasyApache 4 servers - you should already have a /etc/container/php.handler file with content inside:
application/x-httpd-ea-php44-lsphp /opt/cpanel/ea-php44/root/usr/bin/lsphp application/x-httpd-ea-php51-lsphp /opt/cpanel/ea-php51/root/usr/bin/lsphp application/x-httpd-ea-php52-lsphp /opt/cpanel/ea-php52/root/usr/bin/lsphp application/x-httpd-ea-php53-lsphp /opt/cpanel/ea-php53/root/usr/bin/lsphp application/x-httpd-ea-php54-lsphp /opt/cpanel/ea-php54/root/usr/bin/lsphp application/x-httpd-ea-php55-lsphp /opt/cpanel/ea-php55/root/usr/bin/lsphp application/x-httpd-ea-php56-lsphp /opt/cpanel/ea-php56/root/usr/bin/lsphp application/x-httpd-ea-php70-lsphp /opt/cpanel/ea-php70/root/usr/bin/lsphp application/x-httpd-ea-php71-lsphp /opt/cpanel/ea-php71/root/usr/bin/lsphp
For non-cPanel servers:
# cat /etc/container/php.handler
3. Create a .htaccess file in the desired directory where you want to have a different from default PHP version with the right handler.
For cPanel with EasyApache4:
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$"> SetHandler application/x-httpd-ea-php71-lsphp </FilesMatch>
Or to load the alt-php versions:
For non-cPanel servers it's:
<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$"> SetHandler application/x-lsphp71 </FilesMatch>
As a result, subdirectories will use the same PHP version as the parent unless you overwrite it with another .htaccess entry in that subdirectory.
To match PHP extensions selection with extensions selected by the end-user for that PHP version in PHP Selector you have to follow this article.
This way the main website can use native PHP handler (suphp/fcgi) while a subdirectory is using lsapi with necessary PHP version.
Note! There is one little trick that can be confusing. It applies only if you have PHP Selector enabled and you have a non-native version selected there for a user. In that case, if the version that you assign through .htaccess is the same as ea-php version selected as the system default version in WHM -> MultiPHP Manager -> System Default version, that version will not be applied, the version that you'll actually get will be the same as selected in PHP Selector.