Hi there everyone, I've been Googling and haven't found anything how-to-like on the HTF site, just question threads and some 3rd party blog posts regarding install. It's a deb 11 server and ISPC is updated to latest stable. I have two questions: 1) Is there a how-to that is considered preferred for installing composer in my environment? 2) I see a lot of comments regarding problems with jailed SSH users being able to use it. Should I just create a non-jailed SSH user for the domains I want to use composer with? Thanks for your time!
This guide should work though it is not specifically for ISPConfig server: https://www.howtoforge.com/how-to-install-php-composer-on-debian-11/
Thank you so much for your help! I have a question after reading that how-to regarding multiple PHP versions: Since I have PHP versions spanning 5.6 - 8.3, I'm thinking this would only add the required modules for Debian 11's default 7.4, is that correct? Would I need to run this command for each additional version of PHP and if so, do I do that by modifying the packages installed php8.2-common php8.2-zip, etc.?
Thank you. I ran the first install command from the tutorial and surprisingly(to me, at least) it seems to have defaulted to the 8.3 version of PHP. Is this as it should behave or have I done something to change defaults in the Bullseye OS? Code: root@system:~# sudo apt install curl git unzip wget php-common php-zip php-cli php-xml php-gd php-mysql php-bcmath php-imap php-curl php-intl php-mbstring -y Reading package lists... Done Building dependency tree... Done Reading state information... Done curl is already the newest version (7.74.0-1.3+deb11u11). git is already the newest version (1:2.30.2-1+deb11u2). unzip is already the newest version (6.0-26+deb11u1). wget is already the newest version (1.21-1+deb11u1). php-cli is already the newest version (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e). php-common is already the newest version (2:94+0~20240205.51+debian11~1.gbp6faa2e). php-common set to manually installed. php-mbstring is already the newest version (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e). php-xml is already the newest version (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e). php-xml set to manually installed. The following additional packages will be installed: php8.3-bcmath The following NEW packages will be installed: php-bcmath php-curl php-gd php-imap php-intl php-mysql php-zip php8.3-bcmath 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. Need to get 67.8 kB of archives. After this operation, 170 kB of additional disk space will be used. Get:1 https://packages.sury.org/php bullseye/main amd64 php8.3-bcmath amd64 8.3.3-1+0~20240216.17+debian11~1.gbp87e37b [15.8 kB] Get:2 https://packages.sury.org/php bullseye/main amd64 php-bcmath all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,432 B] Get:3 https://packages.sury.org/php bullseye/main amd64 php-curl all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,432 B] Get:4 https://packages.sury.org/php bullseye/main amd64 php-gd all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,428 B] Get:5 https://packages.sury.org/php bullseye/main amd64 php-imap all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,432 B] Get:6 https://packages.sury.org/php bullseye/main amd64 php-intl all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,436 B] Get:7 https://packages.sury.org/php bullseye/main amd64 php-mysql all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,432 B] Get:8 https://packages.sury.org/php bullseye/main amd64 php-zip all 2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e [7,428 B] Fetched 67.8 kB in 4s (17.0 kB/s) Selecting previously unselected package php8.3-bcmath. (Reading database ... 90066 files and directories currently installed.) Preparing to unpack .../0-php8.3-bcmath_8.3.3-1+0~20240216.17+debian11~1.gbp87e3 7b_amd64.deb ... Unpacking php8.3-bcmath (8.3.3-1+0~20240216.17+debian11~1.gbp87e37b) ... Selecting previously unselected package php-bcmath. Preparing to unpack .../1-php-bcmath_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa 2e_all.deb ... Unpacking php-bcmath (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-curl. Preparing to unpack .../2-php-curl_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2e _all.deb ... Unpacking php-curl (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-gd. Preparing to unpack .../3-php-gd_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2e_a ll.deb ... Unpacking php-gd (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-imap. Preparing to unpack .../4-php-imap_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2e _all.deb ... Unpacking php-imap (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-intl. Preparing to unpack .../5-php-intl_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2e _all.deb ... Unpacking php-intl (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-mysql. Preparing to unpack .../6-php-mysql_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2 e_all.deb ... Unpacking php-mysql (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Selecting previously unselected package php-zip. Preparing to unpack .../7-php-zip_2%3a8.3+94+0~20240205.51+debian11~1.gbp6faa2e_ all.deb ... Unpacking php-zip (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-curl (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-mysql (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-intl (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-imap (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php8.3-bcmath (8.3.3-1+0~20240216.17+debian11~1.gbp87e37b) ... Creating config file /etc/php/8.3/mods-available/bcmath.ini with new version Setting up php-zip (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-gd (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Setting up php-bcmath (2:8.3+94+0~20240205.51+debian11~1.gbp6faa2e) ... Processing triggers for php8.3-fpm (8.3.3-1+0~20240216.17+debian11~1.gbp87e37b) ... NOTICE: Not enabling PHP 8.3 FPM by default. NOTICE: To enable PHP 8.3 FPM in Apache2 do: NOTICE: a2enmod proxy_fcgi setenvif NOTICE: a2enconf php8.3-fpm NOTICE: You are seeing this message because you have apache2 package installed. Processing triggers for php8.3-phpdbg (8.3.3-1+0~20240216.17+debian11~1.gbp87e37 b) ... Processing triggers for php8.3-cgi (8.3.3-1+0~20240216.17+debian11~1.gbp87e37b) ... Processing triggers for php8.3-cli (8.3.3-1+0~20240216.17+debian11~1.gbp87e37b) ... root@system:~#
This is explained in the Multi PHP tutorial and what you should do to solve this: https://www.howtoforge.com/ispconfig-php-debian/
If this is the part your speaking of, I did perform that when adding my 8.2 and 8.3 and when I run those commands, 7.4 has an asterisk beside it(It did even without having to change it after the install of those two versions). That's why I'm wondering if perhaps something is messed up as my defaults show 7.4 but when I ran the install string for the modules, it chose 8.3. Code: root@system:~# update-alternatives --config php There are 11 choices for the alternative php (providing /usr/bin/php). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/php.default 100 auto mode 1 /usr/bin/php.default 100 manual mode 2 /usr/bin/php5.6 56 manual mode 3 /usr/bin/php7.0 70 manual mode 4 /usr/bin/php7.1 71 manual mode 5 /usr/bin/php7.2 72 manual mode 6 /usr/bin/php7.3 73 manual mode * 7 /usr/bin/php7.4 74 manual mode 8 /usr/bin/php8.0 80 manual mode 9 /usr/bin/php8.1 81 manual mode 10 /usr/bin/php8.2 82 manual mode 11 /usr/bin/php8.3 83 manual mode Press <enter> to keep the current choice[*], or type selection number: root@system:~# update-alternatives --config php-cgi There are 10 choices for the alternative php-cgi (providing /usr/bin/php-cgi). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/bin/php-cgi8.3 83 auto mode 1 /usr/bin/php-cgi5.6 56 manual mode 2 /usr/bin/php-cgi7.0 70 manual mode 3 /usr/bin/php-cgi7.1 71 manual mode 4 /usr/bin/php-cgi7.2 72 manual mode 5 /usr/bin/php-cgi7.3 73 manual mode * 6 /usr/bin/php-cgi7.4 74 manual mode 7 /usr/bin/php-cgi8.0 80 manual mode 8 /usr/bin/php-cgi8.1 81 manual mode 9 /usr/bin/php-cgi8.2 82 manual mode 10 /usr/bin/php-cgi8.3 83 manual mode Press <enter> to keep the current choice[*], or type selection number: root@system:~# update-alternatives --config php-fpm.sock There are 10 choices for the alternative php-fpm.sock (providing /run/php/php-fpm.sock). Selection Path Priority Status ------------------------------------------------------------ 0 /run/php/php8.3-fpm.sock 83 auto mode 1 /run/php/php5.6-fpm.sock 56 manual mode 2 /run/php/php7.0-fpm.sock 70 manual mode 3 /run/php/php7.1-fpm.sock 71 manual mode 4 /run/php/php7.2-fpm.sock 72 manual mode 5 /run/php/php7.3-fpm.sock 73 manual mode * 6 /run/php/php7.4-fpm.sock 74 manual mode 7 /run/php/php8.0-fpm.sock 80 manual mode 8 /run/php/php8.1-fpm.sock 81 manual mode 9 /run/php/php8.2-fpm.sock 82 manual mode 10 /run/php/php8.3-fpm.sock 83 manual mode Press <enter> to keep the current choice[*], or type selection number: root@system:~#
I ran the install as instructed in the tutorial and composer does run via root but when trying to run it as one of my SSH users in the web directory, composer is not found. Root can run it with a warning that it should never be run as root but my normal user can not. Am I missing something? Code: root@system:~# php composer-setup.php --install-dir=/usr/local/bin --filename=composer All settings correct for using Composer Downloading... Composer (version 2.7.1) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer root@system:~# chmod +x /usr/local/bin/composer root@system:~# composer -v Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 2.7.1 2024-02-09 15:26:28 Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command -q, --quiet Do not output any message -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. --no-scripts Skips the execution of all scripts defined in composer.json file. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. --no-cache Prevent use of the cache -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: about Shows a short information about Composer archive Creates an archive of this composer package audit Checks for security vulnerability advisories for installed packages browse [home] Opens the package's repository URL or homepage in your browser bump Increases the lower limit of your composer.json requirements to the currently installed versions check-platform-reqs Check that platform requirements are satisfied clear-cache [clearcache|cc] Clears composer's internal package cache completion Dump the shell completion script config Sets config options create-project Creates new project from a package into given directory depends [why] Shows which packages cause the given package to be installed diagnose Diagnoses the system to identify common errors dump-autoload [dumpautoload] Dumps the autoloader exec Executes a vendored binary/script fund Discover how to help fund the maintenance of your dependencies global Allows running commands in the global composer dir ($COMPOSER_HOME) help Display help for a command init Creates a basic composer.json file in current directory install [i] Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json licenses Shows information about licenses of dependencies list List commands outdated Shows a list of installed packages that have updates available, including their latest version prohibits [why-not] Shows which packages prevent the given package from being installed reinstall Uninstalls and reinstalls the given package names remove [rm] Removes a package from the require or require-dev require [r] Adds required packages to your composer.json and installs them run-script [run] Runs the scripts defined in composer.json search Searches for packages self-update [selfupdate] Updates composer.phar to the latest version show [info] Shows information about packages status Shows a list of locally modified packages suggests Shows package suggestions update [u|upgrade] Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file validate Validates a composer.json and composer.lock root@system:~# exit logout Connection to schwimserver.com closed. schwim@schwim-vb-mint:~$ ssh user@warcraftian.com Last login: Fri Mar 8 07:49:46 2024 from 98.166.217.186 user@system:~$ cd web user@system:~/web$ composer require guzzlehttp/guzzle:^7.0 bash: composer: command not found I also tried including the full path but it still could not be found.
Still trying to get this working for non-root user, I see this in the tutorial: It states to install it in /usr/local/bin but in the paragraph below, it states that it will install it in the /usr/bin directory, allowing it to be included in the PATH. Did installing in /usr/local/bin and not /usr/bin perhaps cause my issue of not being able to run it as non-root?
That comes to your #2 question which I did not answer because I never done that but there were discussions on how to do that which you may need to research or wait for some others to assist.
I did a quick search and reading based on "site:forum.howtoforge.com jailkit composer". There are few but this one looks most promising: https://forum.howtoforge.com/threads/multiple-php-version-and-composer-with-jailkit.78716/