Search by tag: ovh

1 article

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
Fatal error:  Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0

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