Today I had an hard time helping a friend installing a Laravel PHP application on a WHM-powered OVH Server: since he needed PHP7, the first thing I did was upgrading EasyApache to version 4, which has built-in PHP7 support. Once I did that, enabling PHP7 as a dynamic Apache module was just as easy as adding the following lines to the .htaccess file in the /public_html/ root apache folder:
AddType application/x-httpd-ea-php70 .php .php7 .phtml
It’s worth noting that these commands are automatically added by EasyApache 4 if you choose a PHP7-enabled template among those already shipped with the product.
Right after that, PHP7 worked right off the bat: too bad he also had to run composer/artisan scripts to actually deploy his Laravel-based application, which he hoped he could do via SSH/SCP using the PHP Command-Line Interface. However, as soon as he tried to run the required php artisan commands, he was struck by the fact that the available PHP CLI was 5.4, as it was still the default PHP version referenced by the $PATH environment variable.
In order to fix that, we had to discover where the real path to PHP7 CLI actually was.
Luckily enough, we quickly found the answer that we need by looking at the cPanel support forum:
By knowing that, he was able to run php artisan using the following command:
And run the Composer scripts required by Laravel to create the DB and perform the deploy.