EN FR

Execute a specific version of PHP on OVH shared server from command line

The first step is to find the right executable. For example, the default PHP executable is still in version 5.3.16:

$ php -v
[...]
PHP 5.3.16 (cgi-fcgi) (built: Aug 27 2012 17:36:50)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

Other versions are available and we have to specify them explicitly, as we do for Apache through an .htaccess file. My scripts need at least PHP 5.4 and, to use it in CLI, we need the following executable:

$ php.ORIG.5_4 -v
<br />
<b>Fatal error</b>:  Directive 'allow_call_time_pass_reference' is no longer available in PHP in <b>Unknown</b> on line <b>0</b><br />

OK, we found it but it crashes right away because of the default configuration. To make it work properly, we need to add a flew flags:

$ php.ORIG.5_4 -d allow_call_time_pass_reference=0 -d magic_quotes_gpc=0 -d register_globals=0 /path/to/script.php

"Upgrade to Firefox" bannerSupport La Quadrature du Net!Soutenir FramasoftSupport the Gooseberry project, Blender Foundation's 5th Open Movie project