DEV Community

Cover image for Use PHP CLI 7.3 on OVHcloud Performance hosting
Capripot
Capripot

Posted on

Use PHP CLI 7.3 on OVHcloud Performance hosting

OVHcloud is the 3rd website hosting company worldwide, 1st in Europe. They have a good product called Performance Hosting which includes a direct SSH access to the shared server.

My goal was to use Ruckus Migrations on production the same way I do in my local development. Ruckus is a database migrations manager, it is inspired by the Rake database migration tools available with Ruby-on-Rails framework.

In today's version of the hosting, we can use PHP 7.3

/usr/local/php7.3/bin/php -v
# PHP 7.3.18 (cli) (built: May 20 2020 12:29:48) ( NTS )
Enter fullscreen mode Exit fullscreen mode

Alias it to php7 and source .bashrc so our current terminal re-loads commands present in it.

echo "alias php7='/usr/local/php7.3/bin/php" >> .bashrc
source .bashrc
Enter fullscreen mode Exit fullscreen mode

And we are good to go

php7 ruckus.php db:migrate ENV=production
Enter fullscreen mode Exit fullscreen mode

My original solution

To use it, we need PHP 5.3 minimum. The default php command line on Performance Hosting was PHP 4. But actually, other versions of PHP are available. PHP 5.4.45 cli binary is available under the sweet name of php.ORIG.5_4.

If we try to use it directly, it will complain because it tries to use the php.ini configuration file used for PHP 4, so we should provide the 5.4 ini file. We can find it through the phpinfo() function.

So, after getting to know all these information, we are able to use PHP cli 5.4:

php.ORIG.5_4 -c /usr/local/lib/php.ini-2
Enter fullscreen mode Exit fullscreen mode

But since we probably don’t want to memorize all of that to use PHP cli each time we need it, we should export it as an alias in our .bashrc file.

echo "alias php5='php.ORIG.5_4 -c /usr/local/lib/php.ini-2'" >> .bashrc
Enter fullscreen mode Exit fullscreen mode

After re-sourcing our bash file

. .bashrc
Enter fullscreen mode Exit fullscreen mode

We can now execute our scripts with PHP cli 5.4

php5 ruckus.php db:migrate ENV=production
Enter fullscreen mode Exit fullscreen mode

Originally published on September 23, 2014
Photo by OVHcloud

Top comments (1)

Collapse
 
victorrims68524 profile image
Rimsha Victor Gill

This article presents a solution that enables you to utilize Ruckus database migrations on OVHcloud Performance Hosting. Through the creation of aliases and PHP configuration, executing PHP CLI 5.4 for migrations becomes a straightforward process.