Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer can't find unzip or 7zip when run via php+apache #11923

Open
beeradmoore opened this issue Apr 8, 2024 · 28 comments
Open

Composer can't find unzip or 7zip when run via php+apache #11923

beeradmoore opened this issue Apr 8, 2024 · 28 comments
Labels

Comments

@beeradmoore
Copy link

beeradmoore commented Apr 8, 2024

EDIT: From the bottom of all these tests and various comments it seems that version of Amazon Linux (1, 2, 2023) does not matter, and this is a php5/7 vs php8 issue.

We use a custom php script to run composer install. While migrating our systems to Amazon Linux 2023 we started getting some warnings in these composer installs which have worked on both Amazon Linux 1 and Amazon Linux 2 instances for some time now.

While trying to run this update script we get this output

As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' or '7z' (21.01+) may remediate them.

Note

I understand this may be an issue with something new that has changed in Amazon Linux 2023 or even a problem with Symfony and how it checks for installed package rather than a problem with composer itself, but I am just trying to cover all bases.

The problem with the above warnings is that both unzip and 7zip (7zz) are installed.

In a test script I have made I have a php function that executes commands, I can run this in a browser to reproduce the issue we are having. That function looks like this,

    function runCommand($command)
    {
        $tmp = array();
        
        exec($command.' 2>&1', $tmp, $return_code);
        echo "command: $command<br>";
        echo "return_code: $return_code<br>";
        echo "output: <br>";
        foreach ($tmp as $output_line)
        {
            echo "$output_line<br>";
        }
    }

Running unzip -v gives

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 11.3.1 20221121 (Red Hat 11.3.1-4) for Unix (Linux ELF) on Jan 29 2023.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.8, 13-Jul-2019)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

Running 7zz gives,

command: 7zz
return_code: 0
output:

7-Zip (z) 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
64-bit locale=C.UTF-8 Threads:2 OPEN_MAX:65535, ASM

Usage: 7zz [...] [...] [@listfile]


a : Add files to archive
b : Benchmark
d : Delete files from archive
e : Extract files from archive (without using directory names)
h : Calculate hash values for files
i : Show information about supported formats
l : List contents of archive
rn : Rename files in archive
t : Test integrity of archive
u : Update files to archive
x : eXtract files with full paths


-- : Stop switches and @listfile parsing
-ai[r[-|0]]{@listfile|!wildcard} : Include archives
-ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
-ao{a|s|t|u} : set Overwrite mode
-an : disable archive_name field
-bb[0-3] : set output log level
-bd : disable progress indicator
-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
-bt : show execution time statistics
-i[r[-|0]]{@listfile|!wildcard} : Include filenames
-m{Parameters} : set compression Method
-mmt[N] : set number of CPU threads
-mx[N] : set compression level: -mx1 (fastest) ... -mx9 (ultra)
-o{Directory} : set Output directory
-p{Password} : set Password
-r[-|0] : Recurse subdirectories for name search
-sa{a|e|s} : set Archive name mode
-scc{UTF-8|WIN|DOS} : set charset for console input/output
-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
-scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
-sdel : delete files after compression
-seml[.] : send archive by email
-sfx[{name}] : Create SFX archive
-si[{name}] : read data from stdin
-slp : set Large Pages mode
-slt : show technical information for l (List) command
-snh : store hard links as links
-snl : store symbolic links as links
-sni : store NT security information
-sns[-] : store NTFS alternate streams
-so : write data to stdout
-spd : disable wildcard matching for file names
-spe : eliminate duplication of root folder for extract command
-spf[2] : use fully qualified file paths
-ssc[-] : set sensitive case mode
-sse : stop archive creating, if it can't open some input file
-ssp : do not change Last Access Time of source files while archiving
-ssw : compress shared files
-stl : set archive timestamp from the most recently modified file
-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
-stx{Type} : exclude archive type
-t{Type} : Set type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
-v{Size}[b|k|m|g] : Create volumes
-w[{path}] : assign Work directory. Empty path means a temporary directory
-x[r[-|0]]{@listfile|!wildcard} : eXclude filenames
-y : assume Yes on all queries

But the output of composer diagnose -vvv is,

command: composer diagnose -vvv
return_code: 0
output:
Running 2.7.2 (2024-03-11 17:12:18) with PHP 8.2.15 on Linux / 6.1.82-99.168.amzn2023.x86_64
Failed to initialize global composer: Composer could not find the config file: /usr/share/httpd/.composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
Executing command (CWD): git --version
OK git version 2.40.1
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Checking Composer and its dependencies for vulnerabilities: Downloading https://repo.packagist.org/packages.json if modified
[200] https://repo.packagist.org/packages.json
Downloading https://packagist.org/api/security-advisories/
[200] https://packagist.org/api/security-advisories/
OK
Composer version: 2.7.2
PHP version: 8.2.15
PHP binary path:
OpenSSL version: OpenSSL 3.0.8 7 Feb 2023
cURL version: 8.5.0 libz 1.2.11 ssl OpenSSL/3.0.8
zip: extension present, unzip not available, 7-Zip not available

This here is also reproting that unzip and 7-Zip are not avaialble.

zip: extension present, unzip not available, 7-Zip not available

But even above it was able to see and execute git and see that it is available.

Executing command (CWD): git --version
OK git version 2.40.1

I also wondered if things are installed in other places and there is an access issue.

$ which git
/usr/bin/git
$ which 7zz
/usr/bin/7zz
$ which unzip
/usr/bin/unzip

So I am at a loss as to why I can execute unzip and 7zz but executing composer seems to think they are not avaialbe.

Additionally running diagnose from command line as the apache user gives full green lights.

$ sudo -Hu apache composer diagnose -vvv
Running 2.7.2 (2024-03-11 17:12:18) with PHP 8.2.15 on Linux / 6.1.82-99.168.amzn2023.x86_64
Failed to initialize global composer: Composer could not find the config file: /usr/share/httpd/.composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
Executing command (CWD): git --version
OK git version 2.40.1
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Checking Composer and its dependencies for vulnerabilities: Downloading https://packagist.org/api/security-advisories/
[200] https://packagist.org/api/security-advisories/
OK
Composer version: 2.7.2
PHP version: 8.2.15
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 3.0.8 7 Feb 2023
cURL version: 8.5.0 libz 1.2.11 ssl OpenSSL/3.0.8
zip: extension present, unzip present, 7-Zip present (7zz)

EDIT: Disabling SELinux did not fix the issue.

@beeradmoore
Copy link
Author

I could be thinking/looking at everything out of context so please let me know if any of the below is wrong.

Looking at composer source I think like it is using symfony/process v5.4.36. This worried me at first knowing that there is a v7 out there, but looking at the releases it appears they keep a stable branch of 5, 6, and 7.

Looking at the v5.4 branch I copied the code and ran it in my test script.

    function find(string $name, ?string $default = null, array $extraDirs = [])
    {       
        if (\ini_get('open_basedir')) {
            $searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);
            $dirs = [];
            foreach ($searchPath as $path) {
                // Silencing against https://bugs.php.net/69240
                if (@is_dir($path)) {
                    $dirs[] = $path;
                } else {
                    if (basename($path) == $name && @is_executable($path)) {
                        return $path;
                    }
                }
            }
        } else {
            $dirs = array_merge(
                explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
                $extraDirs
            );
        }

        $suffixes = [''];
        if ('\\' === \DIRECTORY_SEPARATOR) {
            $pathExt = getenv('PATHEXT');
            $suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
        }
        foreach ($suffixes as $suffix) {
            foreach ($dirs as $dir) {
                if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
                    return $file;
                }
            }
        }

        return $default;
    }

    var_dump(find('unzip'));

and this output

string(14) "/usr/bin/unzip"

which makes me think the checking of the executable is working fine.

Going back to the composer source I can't see why this would not run correclty.

Even

    $hasSystemUnzip = (bool) find('unzip');
    var_dump($hasSystemUnzip);

outputs

bool(true)

Running from source vs running from what I dowonload from here might be different, but I don't see what that could be. Any help would be appreciated.

@beeradmoore
Copy link
Author

beeradmoore commented Apr 8, 2024

I was able to re-produce this on a fresh Amazon Linux 2 as well as Amazon Linux 2023

Setup code for Amazon Linux 2

sudo su
yum install httpd
amazon-linux-extras install php8.2
systemctl start httpd
curl -sS https://getcomposer.org/installer | php -- --version=2.7.2
mv composer.phar /usr/bin/composer

echo "<?php

    function runCommand(\$command)
    {
        \$tmp = array();
        
        exec(\$command.' 2>&1', \$tmp, \$return_code);
        echo 'command: '.\$command.'<br>';
        echo 'return_code: '.\$return_code.'<br>';
        echo 'output: <br>';
        foreach (\$tmp as \$output_line)
        {
            echo \$output_line.'<br>';
        }
        echo '<br>';
    }

    runCommand('unzip -v');
    runCommand('composer diagnose -vvv');

" > /var/www/html/test.php

And setup instructions for a fresh Amazon Linux 2023,


sudo su
dnf install httpd php8.2 php8.2-zip
systemctl start httpd
curl -sS https://getcomposer.org/installer | php -- --version=2.7.2
mv composer.phar /usr/bin/composer

echo "<?php

    function runCommand(\$command)
    {
        \$tmp = array();
        
        exec(\$command.' 2>&1', \$tmp, \$return_code);
        echo 'command: '.\$command.'<br>';
        echo 'return_code: '.\$return_code.'<br>';
        echo 'output: <br>';
        foreach (\$tmp as \$output_line)
        {
            echo \$output_line.'<br>';
        }
        echo '<br>';
    }

    runCommand('unzip -v');
    runCommand('composer diagnose -vvv');

" > /var/www/html/test.php

Going to both in browser with http://[IP]/test.php and I get

Amazon Linux 2

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 7.3.1 20180712 (Red Hat 7.3.1-15) for Unix (Linux ELF) on Dec 1 2022.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.6, 6-Sept-2010)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

command: composer diagnose -vvv
return_code: 2
output:
Running 2.7.2 (2024-03-11 17:12:18) with PHP 8.2.9 on Linux / 5.10.213-201.855.amzn2.x86_64
Failed to initialize global composer: Composer could not find the config file: /usr/share/httpd/.config/composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
Executing command (CWD): git --version
No git process found
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking Composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Checking Composer and its dependencies for vulnerabilities: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
Downloading https://packagist.org/api/security-advisories/
[200] https://packagist.org/api/security-advisories/
OK
Composer version: 2.7.2
PHP version: 8.2.9
PHP binary path:
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
cURL version: 8.3.0 libz 1.2.7 ssl OpenSSL/1.0.2k-fips
zip: extension present, unzip not available, 7-Zip not available

Amazon Linux 2023

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 11.3.1 20221121 (Red Hat 11.3.1-4) for Unix (Linux ELF) on Jan 29 2023.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.8, 13-Jul-2019)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

command: composer diagnose -vvv
return_code: 2
output:
Running 2.7.2 (2024-03-11 17:12:18) with PHP 8.2.15 on Linux / 6.1.82-99.168.amzn2023.x86_64
Failed to initialize global composer: Composer could not find the config file: /usr/share/httpd/.config/composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
Executing command (CWD): git --version
No git process found
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking Composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Checking Composer and its dependencies for vulnerabilities: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
Downloading https://packagist.org/api/security-advisories/
[200] https://packagist.org/api/security-advisories/
OK
Composer version: 2.7.2
PHP version: 8.2.15
PHP binary path:
OpenSSL version: OpenSSL 3.0.8 7 Feb 2023
cURL version: 8.5.0 libz 1.2.11 ssl OpenSSL/3.0.8
zip: extension present, unzip not available, 7-Zip not available

Same zip: extension present, unzip not available, 7-Zip not available for them both. Which is odd, as I am using composer to deploy in a different environment with Amazon Linux 2 via php without issues 🤔. Confirming there are no warnings there, and comparing installed packages.

EDIT: Other env where I thought things were without warnings is in fact not without warnings and it gives me the follwing when installing composer packages. (older composer, older php)

As there is no 'unzip' nor '7z' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' or '7z' may remediate them.

Diagnostics on this server,

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 7.3.1 20180712 (Red Hat 7.3.1-15) for Unix (Linux ELF) on Dec 1 2022.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.6, 6-Sept-2010)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

command: composer diagnose -vvv
return_code: 2
output:
Running 2.2.7 (2022-02-25 11:12:27) with PHP 8.0.30 on Linux / 5.10.198-187.748.amzn2.x86_64
Failed to initialize global composer: Composer could not find the config file: /usr/share/httpd/.composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
OK
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
You are not running the latest stable version, run `composer self-update` to update (2.2.7 => 2.7.2)
Composer version: 2.2.7
PHP version: 8.0.30
PHP binary path:
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
cURL version: 8.3.0 libz 1.2.7 ssl OpenSSL/1.0.2k-fips
zip: extension present, unzip not available, 7-Zip not available

I am going to have to see if I have logs to dig into to see if this has always been the case. I don't think it has beem but I could be wrong. In either case it shouldn't be happening as the required packages are installed.

EDIT 2:

Running that on our Amazon Linux 1 server we are updating from

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 4.8.3 20140911 (Red Hat 4.8.3-9) for Unix (Linux ELF) on Aug 17 2016.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

command: HOME=/home/ec2-user composer diagnose -vvv
return_code: 2
output:
Running 2.2.23 (2024-02-08 15:08:53) with PHP 7.1.33 on Linux / 4.14.33-51.37.amzn1.x86_64
Failed to initialize global composer: Composer could not find the config file: /home/ec2-user/.config/composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
OK
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Composer version: 2.2.23
PHP version: 7.1.33
PHP binary path: /usr/bin/php-7.1
OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017
cURL version: 7.61.1 libz 1.2.8 ssl OpenSSL/1.0.2k
zip: extension present, unzip present, 7-Zip not available

zip: extension present, unzip present, 7-Zip not available

👀

EDIT 3:

Amazon Linux 2, default out of the box php (5.4.16). I can't install php 7 from Amazon Linux Extras,

command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 7.3.1 20180712 (Red Hat 7.3.1-15) for Unix (Linux ELF) on Dec 1 2022.

UnZip special compilation options:
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: other] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.6, 6-Sept-2010)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

command: HOME=/home/ec2-user composer diagnose -vvv
return_code: 2
output:
Running 2.2.23 (2024-02-08 15:08:53) with PHP 5.4.16 on Linux / 5.10.213-201.855.amzn2.x86_64
Failed to initialize global composer: Composer could not find the config file: /home/ec2-user/.config/composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Checking platform settings: OK
Checking git settings: Executing command (CWD): git config color.ui
OK
Checking http connectivity to packagist: Downloading http://repo.packagist.org/packages.json
[200] http://repo.packagist.org/packages.json
OK
Checking https connectivity to packagist: Downloading https://repo.packagist.org/packages.json
[200] https://repo.packagist.org/packages.json
OK
Checking github.com rate limit: Downloading https://api.github.com/rate_limit
[200] https://api.github.com/rate_limit
OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: Downloading https://getcomposer.org/versions
[200] https://getcomposer.org/versions
OK
Composer version: 2.2.23
PHP version: 5.4.16
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
cURL version: 8.3.0 libz 1.2.7 ssl OpenSSL/1.0.2k-fips
zip: extension present, unzip present, 7-Zip not available

From this I can only see that things don't work as expected on php8, but seem fine on php5 and php7.

@Seldaek
Copy link
Member

Seldaek commented Apr 15, 2024

The only thing I can think of is that the PATH env var somehow gets messed up/restricted in some env/cases. What exactly causes that I have no clue though, I am not familiar at all with Amazon Linux sorry.

Note that for git we never actually check its presence using the executable finder, we just attempt to execute it.

@beeradmoore
Copy link
Author

beeradmoore commented Apr 15, 2024

Is there any commands that make composer output it's known env by any chance?

If not I can look at what a phar is and making my own to do just that.

I'll also double check I can't replicate on Ubuntu just to be sure.

@Seldaek
Copy link
Member

Seldaek commented Apr 15, 2024

You can just clone this repo and run bin/composer instead of the phar to debug stuff. Or run bin/compile to make your own phar if that's easier to get deployed

@beeradmoore
Copy link
Author

Aighty, so I got that running.

I setup a basic getenv test.
From my script I call in the browser I have

    foreach (getenv() as $key => $value)
    {
        echo "$key - $value<br />";
    }

which outputs,

USER - apache
HOME - /usr/share/httpd

From a seperate script I call with runCommand('php other_script.php'); (so running the same test but from php cli) which outputs the following. So the environment slightly changes. Confused why there is no PATH output here though.

command: php other_script.php
return_code: 0
output:
USER - apache
PWD - /var/www/vhost/mySite.com/htdocs/api
SHLVL - 1
HOME - /usr/share/httpd
_ - /usr/bin/php

I modified the bottom of composer iiagnose to have the following

    foreach (getenv() as $key => $value)
    {
        $io->write("$key - $value");
    }

    $this->runCommand($io, 'unzip -v');

    ....

    private function runCommand($io, $command)
    {
        $tmp = array();

        exec($command.' 2>&1', $tmp, $return_code);
        $io->write('command: '.$command);
        $io->write('return_code: '.$return_code);
        $io->write('output:');
        foreach ($tmp as $output_line)
        {
            $io->write($output_line);
        }
        $io->write('');
    }

which I executed with

runCommand('/var/www/vhost/mySite.com/composer-2.7.2/bin/composer diagnose -vvv');

and the bottom part of that output was,

...
cURL version: 8.3.0 libz 1.2.7 ssl OpenSSL/1.0.2k-fips
zip: extension present, unzip not available, 7-Zip not available
USER - apache
PWD - /var/www/vhost/mySite.com/htdocs/api
SHLVL - 1
HOME - /usr/share/httpd
_ - /var/www/vhost/mySite.com/composer-2.7.2/bin/composer
COMPOSER_BINARY - /var/www/vhost/mySite.com/composer-2.7.2/bin/composer
LINES - 50
COLUMNS - 80
SHELL_VERBOSITY - 3
command: unzip -v
return_code: 0
output:
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
...

My takeaway from that is composer can use unzip, but the symfony code to detect unzip does not work.

I'll continue down this rabbit hole and make a standalone bit of code for symfony and play around with the detection. I'll also make an Ubuntu webserver and replicate it as I mentioned above.

@Seldaek
Copy link
Member

Seldaek commented Apr 16, 2024

Ok this is very odd, if there is no PATH available I don't know how just executing zip would work 🤷🏻

@beeradmoore
Copy link
Author

Ah, I think that may have been my bad. The getenv call in php operates differently to how the env would be set for exec.

runCommand('echo $PATH');
command: echo $PATH
return_code: 0
output:
/usr/local/bin:/usr/bin

So the PATH does contain the things it would expect.

I still need to compare against Ubuntu and see if it's an issue with composer running via php-fpm via apache.

I think I will have to go take all of this to symfony, as it now looks like it's their code that is failing to detect executables and composer is just (understandably) going along with it.

@Seldaek
Copy link
Member

Seldaek commented Apr 17, 2024

So if you do exec('echo $PATH'); it outputs the path, but var_dump($_SERVER['PATH'], getenv('PATH')); is empty?

@beeradmoore
Copy link
Author

beeradmoore commented Apr 17, 2024

Both

var_dump($_SERVER['PATH']);

and

var_dump(getenv('PATH'));

output

But

foreach (getenv(null) as $key => $value)
{
    echo "$key - $value<br />";
}

only outputs

USER - apache
HOME - /usr/share/httpd

which is odd because unless I am misunderstanding the docs it should output them all.

EDIIT:

Woah.. this is odd

    var_dump($_SERVER['PATH']);
    echo '<br />';    
    foreach (getenv(null) as $key => $value)
    {
        echo "$key - $value<br />";
    }
    echo "<br />";

I would expect just the stuff we saw above, but nope!

string(49) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
USER - apache
HOME - /usr/share/httpd
SCRIPT_NAME - /api/test.php
REQUEST_URI - /api/test.php
QUERY_STRING -
REQUEST_METHOD - GET
SERVER_PROTOCOL - HTTP/2.0
GATEWAY_INTERFACE - CGI/1.1
REMOTE_PORT - 51080
SCRIPT_FILENAME - /var/www/vhost/mysite.com/htdocs/api/test.php
SERVER_ADMIN - support@mysite.com
CONTEXT_DOCUMENT_ROOT - /var/www/vhost/mysite.com/htdocs
CONTEXT_PREFIX -
REQUEST_SCHEME - https
DOCUMENT_ROOT - /var/www/vhost/mysite.com/htdocs
REMOTE_ADDR - REDACTED
SERVER_PORT - 443
SERVER_ADDR - REDACTED
SERVER_NAME - mysite.com
SERVER_SOFTWARE - Apache
SERVER_SIGNATURE -
PATH - /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_HOST - mysite.com
HTTP_COOKIE - REDACTED
HTTP_ACCEPT_LANGUAGE - en-AU,en;q=0.9
HTTP_ACCEPT_ENCODING - gzip, deflate, br, zstd
HTTP_SEC_FETCH_DEST - document
HTTP_SEC_FETCH_USER - ?1
HTTP_SEC_FETCH_MODE - navigate
HTTP_SEC_FETCH_SITE - none
HTTP_ACCEPT - text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
HTTP_USER_AGENT - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
HTTP_UPGRADE_INSECURE_REQUESTS - 1
HTTP_DNT - 1
HTTP_SEC_CH_UA_PLATFORM - "macOS"
HTTP_SEC_CH_UA_MOBILE - ?0
HTTP_SEC_CH_UA - "Microsoft Edge";v="123", "Not:A-Brand";v="8", "Chromium";v="123"
HTTP_CACHE_CONTROL - max-age=0
proxy-nokeepalive - 1
H2_STREAM_TAG - 82-1
H2_STREAM_ID - 1
H2_PUSHED_ON -
H2_PUSHED -
H2_PUSH - off
H2PUSH - off
HTTP2 - on
SSL_TLS_SNI - mysite.com
HTTPS - on
UNIQUE_ID - REDACTED
FCGI_ROLE - RESPONDER
PHP_SELF - /api/test.php
REQUEST_TIME_FLOAT - 1713344832.87
REQUEST_TIME - 1713344832

Warning: Array to string conversion in api/test.php on line 7
argv - Array
argc - 0

It's almost like getenv does not work until $_SERVER is called.

Testing composer diag after the $_SERVER vardump still gives zip: extension present, unzip not available, 7-Zip not available

Posted that to Stack Overflow though because I am confused why that is.

@Seldaek
Copy link
Member

Seldaek commented Apr 17, 2024

This is most likely because of the auto_globals_jit php.ini setting:

When enabled, the SERVER, REQUEST, and ENV variables are created when they're first used (Just In Time) instead of when the script starts. If these variables are not used within a script, having this directive on will result in a performance gain.

I guess getenv does not trigger initialization of $_SERVER. That sounds like a bug to me.. but anyway that's another problem.

I also cannot reproduce this within a CLI context. I am not sure how you run composer exactly but it looks to be through an apache web request, so some things may be different in that context 🤷🏻

@beeradmoore
Copy link
Author

beeradmoore commented Apr 17, 2024

Confirmed, setting auto_globals_jit = Off will then allow the getenv loop to work as expected. Thanks for pointing me in the right direction for that. I feel that is a bug, will also jot that down to look for php bugs and if not file one. When I get around to setting up an ubuntu server I'll also see if that has the same behaviour or if its some weird Amazon Linux thing.

Back to the problem. It's odd that I also can't replicate via CLI, only when script is run via apache. I am now curious if running composer via a webhook is just not very common, and so long as you have php-zip installed it will still work fine so people havn't realised it or brought it up. OR its something very specific to my situation 😅

I havn't had time yet but when I do I'll do the following and get back to this thread with more info.

  • Test in an Ubuntu webserver to rule out Amazon Linux 2 issue or not
  • Test with nginx + php-fpm to rule out it being an apache issue or not
  • Create small repro of a project with just symfony trying to see if unzip exists
  • If probem is replicatable go report it to them and reference this

Now that I have composer running from source I can also try these

  • Double check it isn't using unzip/7z even though the warning says it isn't
  • Edit the source check to have it say "yep, unzip/7z is installed" and see if it executes correctly

@Seldaek
Copy link
Member

Seldaek commented Apr 18, 2024

Using composer within a web SAPI is definitely not the most common, although some others do it. I'm not sure if they've run into issues with unzip not being detected though. Maybe @Toflar has a clue here.

@Seldaek
Copy link
Member

Seldaek commented Apr 18, 2024

And btw the ZipDownloader does also check which unzip software is available using ExecutableFinder, so if diagnose reports it is missing it should not be using it at install time.

@Toflar
Copy link
Contributor

Toflar commented Apr 18, 2024

Forgive me if I did not get the point of this issue - my time is too limited to study all of your comments but just from skimming this issue I can tell that you somehow compare the web request to the CLI request?
These are of course very different. Just like you can use different PHP versions you can also compile different PHP extensions and configurations for each and every instance. So it's totally normal that the web version might not have access to some extension whereas the CLI does. Not saying it's the way I would configure my systems but from experience I can tell you: it happens a lot :)
@Seldaek you probably pinged me because we built a web based GUI for Composer but that actually works a bit differently. We actually break out of the web request by forking a child process which works totally differently depending on the OS and the available commands and stuff. It's black magic but it helps us to use the CLI binary in most cases.

@Seldaek
Copy link
Member

Seldaek commented Apr 18, 2024

I see, then you probably would not have run in the issue here (TLDR: unzip is not detected when running in apache SAPI, because somehow the PATH is not set correctly? Or something 🤷🏻)

@Toflar
Copy link
Contributor

Toflar commented Apr 18, 2024

I suspect @beeradmoore is using mod_php when using with Apache? PHP runs as the same user as Apache then. Maybe the tests web vs. CLI are executed using two different users with two different PATHs? Then we're comparing apples with oranges of course :)

@beeradmoore
Copy link
Author

beeradmoore commented Apr 18, 2024

From my understanding we are not using mod_php as we are using php-fpm. I think mod_php is when php is loaded as an apache module, but instead with this php is running as its own process and apache communicates with that. php is still running as the apache user though.

I am not sure about pathing and other env, but it isn't 100% the apache user as running CLI as my user, or as apache gives the same result of zip being detected.

composer diagnose -vvv

sudo -Hu apache composer diagnose -vvv

Looking at our older php5/7 servers I think they were using mod_php, ironically when it was working.

I just did one of the tests I mentioned above and modified find method in symfony/process/ExecutableFinder.php which is part of the composer I am running from source.

public function find(string $name, ?string $default = null, array $extraDirs = [])
{       
        if ($name == 'unzip')
        {
                return '/usr/bin/unzip';
        }
        ...

and then run my normal deploy script and it worked perfectly fine.

With that info I would be happy to stop here and say that this issue is 100% a symfony problem (EDIT: reproduction of symfony outside of composer and it is able to find unzip :| ). I wouldn't expect composer to re-write its process finding code to do its own thing instead of relying on symfony. I'll go reproduce in a smaller example and file an issue there and see what comes of it.

If they were able to fix it on their end what is the process to get that in composer? Is there a set release schedule, is there anything stopping composer from doing a version bump, etc

Thanks heaps for the responses above, helped me figure out how to debug it further.

@Toflar
Copy link
Contributor

Toflar commented Apr 18, 2024

Can you check the following differences between your web and CLI setups (make sure you log in as the respective user):

  • The $PATH environment variable. That's where your binaries are going to be searched for. It should contain a colon separated list of directories.
  • The open_basedir PHP ini setting

@beeradmoore
Copy link
Author

Reproducing the issue didn't go well,

test.php

<?php
    require_once '/var/www/vhost/composer-2.7.2/vendor/autoload.php';
    use Symfony\Component\Process\ExecutableFinder;
    $finder = new ExecutableFinder;
    $hasSystemUnzip = (bool) $finder->find('unzip');
    var_dump($hasSystemUnzip);
bool(true)

But if I try something like this in a web request

exec('php test.php', $tmp, $return_code);

also reports in $tmp that it got

bool(true)

Considering that same code within composer executed in (as far as I am aware, the exact same way) I would have expected that second one to incorrectly report false.

As for the things you asked for

sudo -Hu apache echo $PATH

/sbin:/bin:/usr/sbin:/usr/bin

sudo -Hu apache php -i | grep open_basedir

open_basedir => no value => no value

Via request in browser

<?php
    var_dump(ini_get('open_basedir'));
string(0) ""

Also request in browser,

<?php
    var_dump($_SERVER['PATH']);
string(49) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"

@Toflar
Copy link
Contributor

Toflar commented Apr 18, 2024

Composer restarts itself in case xdebug is activated - probably this might be another hint? See https://github.com/composer/xdebug-handler

@beeradmoore
Copy link
Author

Oh, thanks for that link. That is very handy.

Things are starting to fall together. When composer restarts I think it no longer has PATH. I modified the bottom of execute in src/Composer/Command/DiagnoseCommand.php to try output path. (I also disabled auto_globals_jit so we don't run into that other problem)

protected function execute(InputInterface $input, OutputInterface $output): int
{
    ....
    $io->write("| PATH - ".getenv('PATH')."|");
    return $this->exitCode;
}

output of that which is important

| PATH - |

The bit that falls into place is from from the tests above

Checking git settings: Executing command (CWD): git config color.ui
Executing command (CWD): git --version
OK git version 2.40.1

and I was curious that find( found git. But then Seldaek said,

Note that for git we never actually check its presence using the executable finder, we just attempt to execute it.

So find( would have also failed in those situations but because it doesn't check it just goes for it 😅

I am about to stop for the night, but when I debug this some more soon I'll see if I can force composer to not restart and if that works I'll see if I can figure out why PATH isn't being passed along.

@Seldaek
Copy link
Member

Seldaek commented Apr 18, 2024

Yeah if this gets fixed in symfony 5.4.x (which it should if it can be fixed, but I'm still not sure it isn't an environment problem) we will get the fix in the next patch release.

@Toflar
Copy link
Contributor

Toflar commented Apr 18, 2024

You can force Composer not to restart by setting COMPOSER_ALLOW_XDEBUG=1, it will slow down Composer considerably though. What you should do instead (if you can in your setup) is disable xdebug before even calling Composer - let's see if that brings you consistent results.

Also, it's not all Symfony Process. Composer's XdebugHandler directly uses proc_open() for the restart logic: https://github.com/composer/xdebug-handler/blob/main/src/XdebugHandler.php#L283

@beeradmoore
Copy link
Author

Sorry, I missed the second half of this,

Composer restarts itself in case xdebug is activated

I don't have xdebug enabled. This server may have had it enabled at some point. In previous testing above I started a new server and installed everything from scratch so I know it didn't have xdebug there.

I'll dig into that and see if it's restarting when it shouldn't be.

@johnstevenson
Copy link
Member

Set XDEBUG_HANDLER_DEBUG=1 and you'll see XdebugHandler diagnostic output on stderr.

@beeradmoore
Copy link
Author

Hey @johnstevenson , any idea where I'd expect for php to send stderr to? I assumed /var/log/php-fpm/error.log or /var/log/php-fpm/www-error.log but there is nothing new when I run this script

<?php

    putenv('COMPOSER_ALLOW_XDEBUG=1');
    putenv('XDEBUG_HANDLER_DEBUG=1');


    function runCommand($command)
    {
        $tmp = array();
        
        exec($command.' 2>&1', $tmp, $return_code);
        echo 'command: '.$command.'<br>';
        echo 'return_code: '.$return_code.'<br>';
        echo 'output: <br>';
        foreach ($tmp as $output_line)
        {
            echo $output_line.'<br>';
        }
        echo '<br>';
    }


    runCommand('/var/www/vhost/composer-2.7.2/bin/composer diagnose -vvv');
    

I also tried runCommand like this

    runCommand('COMPOSER_ALLOW_XDEBUG=1 XDEBUG_HANDLER_DEBUG=1 /var/www/vhost/composer-2.7.2/bin/composer diagnose -vvv');

@johnstevenson
Copy link
Member

There will only be output if STDERR is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants