Set php version for a site.

Discussion in 'Installation/Configuration' started by Ole Vangen, Mar 14, 2020.

  1. Ole Vangen

    Ole Vangen Member

    Hi I have installed two php versions on my server.
    I have created a site and set that php 7.2 shall be used.

    When I type from the commandline php -v I get an older version of php .
    I also get an error when I try to execute an app that states I have an older version of php.
    I guess something is not working as it should or I need to add some parameters or links in the admin panel on the site.

    I know it is possible to create an .htaccess file that can set that the folder and it subfolders should use php version xx .
    Does anyone have the script that should be placed in .htaccess to "force" PHP 7.2 to be used.
    Anything else I must do to make it work?

    :D Thx
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    How did you do that? Which Operating System? Which version of ISPConfig?
    The supported way to get additional PHP versions for website use for Debian and Ubuntu is explained in this Tutorial: https://www.howtoforge.com/tutorial...fig-3-from-debian-packages-on-debian-8-and-9/
    If you use PHP from command line or scripts, you need to adjust PATH so the correct PHP version is found or set alias php to the version you want.
     
  3. Ole Vangen

    Ole Vangen Member

    Thanks for answer Taleman.
    SO when this path is in my ISPCONfig

    /opt/php-7.2/bin/php-cgi
    /opt/php-7.2/lib
    It si properly the issues because in the tutorial it is mention the following url to use..

    PHP 7.2
    Path to the PHP FastCGI binary: php-cgi7.2
    Path to the php.ini directory: /etc/php/7.2/cgi/php.ini
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    You compiled PHP packages as it seems while the tutorial @Taleman mentioned installs packages. These are two completely different methods of installing PHP but in both ways you achieve the same goal. So both are correct, your path is correct for the way you installed PHP and the paths in the other guide are correct as well. Do not change your paths to the ones mentioned in the other guide, or PHP will completely fail for that site.

    Back to your original problem, you mix up the website PHP with the command line PHP. The commandline PHP is the default version of the operating system that you use, you get that version when you run the PHP command on the shell. The website PHP, which you can select in ISPConfig, is the PHP version that the website uses to process PHP scripts that you call by HTTP or https. If you want to get details on that version, use the phpinfo() command inside a PHP file which is located in that website.
     

Share This Page