Use Composer and different PHP Versions

Discussion in 'Installation/Configuration' started by sunghost, Apr 23, 2024.

  1. sunghost

    sunghost Member

    Hi all,
    i want to install drupal with composer. I configure a normal website with php8.2 and installed the php8.2-phar package system wide. If i log in via ssh into the webspace and run composer create-project drupal/recommended-project ../web/ i get error message PHPs phar extension is missing. If i create an phpversion.php file with phpinfo() i see correct PHP 8.2 Version with installed par extension. If i enter php -v i got old PHP Version 7.0. My question is how to configure composer in isp to use different PHP Version and the one i specialy configure for website.

    Thx
     
    Last edited: Apr 23, 2024
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You can prepend the PHP binary of the version you want to use before the compose command. Example:

    Code:
    php8.2 -f /usr/local/bin/composer update
     
  3. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    You mean, using the chroot user of that webspace?
    Using jailkit?
    In that case, one would need to add extensions or different applications which should be available to a list.
    If you have multiple php versions this could be an explaination.
    Though php 7.0? really?
    Which OS are you using? This version shouldn't be out there anymore imho
     
  4. sunghost

    sunghost Member

    Thanks Till, i didnt use the full path to composer.
     
  5. sunghost

    sunghost Member

    Yes its the chroot user with jailkit. Its on Debian 11, but the Server is initial setup as PHP 7.0 was out. I will change it to PHP8.2.
     
  6. sunghost

    sunghost Member

    I could install drupal via composer now, but the process seems to install a project folder direct in web/ Dir and under that drupal in another web directory. Is there a way to install drupal direct in the web root? If not i have to configure a Redirect to the drupal web folder. Any recommendations and experience with that?
    thx
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Not a redirect, you must alter the root of the document of the site. Do you use Apache or Nginx?
     
  8. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    yes, you need to add a redirect, or a snippet for your webserver config.
    heh ok, @till allows to change the document root, go for it, this is better
     
    ahrasis likes this.
  9. sunghost

    sunghost Member

    Apache, i never changed the document root in the past. I see unter website and domain the path but its not changeable. Where to do that?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    You can change it using the apache directives field of the website. E.g. you installed drupal into ..../web/somefolder/ then you add this in the Apache directives field:

    Code:
    DocumentRoot {DOCROOT_CLIENT}/somefolder/
    Chnage the word somefolder to the right folder name.
     
    ahrasis and ztk.me like this.
  11. sunghost

    sunghost Member

    Hi till,
    yes of course in the apache directives. Thanks for pointing me to that. Thanks ztk.me also for your reply.
     
    ztk.me likes this.

Share This Page