PHP versions from command line

Discussion in 'Programming/Scripts' started by fast928, Feb 28, 2022.

  1. fast928

    fast928 New Member HowtoForge Supporter

    I have ispconfig 3 set up & installed many remi repository php versions 54 thru 81. An in house server for a company, the intranet web portion is running 5.4 due to how old it is. Other sites (main website) are running later versions of php (7). I need to run 5.4 from command line to generate a report made for the older php. How can I access different versions of php from command line depending what I need? The default running on the server is newer. Tried running to the remi 54 via direct path but still ran server default. This is on a centos 7.9 server.
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Specify the full path to the PHP executable you want to use.
     
    Last edited: Feb 28, 2022
  3. michelangelo

    michelangelo Active Member

    The remi repo PHP packages provide also the CLI binaries for each PHP version.
    These can be found in "/opt/remi/<php>/root/usr/bin" but the Remi packages actually also creates a symlink to these CLI binaries.

    Bash-wise you should be able to use them via the following schema: php<major><minor> (php54, php70, php74, php81) OR you could make use of the capatibilities that the Software Collection Library provide.

    Just issue "source /opt/remi/php54/enable" and the standard php command will change into that of PHP 5.4 as long as the Bash session is alive.
     
    Jesse Norell likes this.

Share This Page