Topic: composer, php-composer & scl

Hi Rémi, I'm looking for composer I understand you build it your repo http://rpms.remirepo.net/enterprise/6/r … poser.html .

I cannot find it in SCL or RHSCL.
Is there a reason you did not port it to scl ? Or perhaps I just need to change my eyes :-)

Thank you,

Re: composer, php-composer & scl

In SCL, I only build "arched" packages.

But composer in base system also works with php from SCL (uses current PHP version)


P.S. my first-name is only "Remi", not "Rémi" wink

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: composer, php-composer & scl

Hum, sorry to mangle your firstname .... I understand I need to ask RedHat support to add it in RHSCL.

Re: composer, php-composer & scl

oduquesne wrote:

I understand I need to ask RedHat support to add it in RHSCL.

Sorry, but why ?
As I said, base version is designed to work with both base PHP and SCL version.

Look at the shebang:

$ head -n1 /usr/bin/composer 
#!/usr/bin/env php

P.S. and I really think RH will not package it, because of tons of dependencies, including symfony components (and too much active)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: composer, php-composer & scl

Yes, but composer itself is not provided by RedHat but by your repo, ins't it ? What about technical support in case of emergency ?

Re: composer, php-composer & scl

oduquesne wrote:

Yes, but composer itself is not provided by RedHat but by your repo, ins't it ?

It is also in EPEL (7 only)


oduquesne wrote:

What about technical support in case of emergency ?

Yes, no support (well... "best effort" from community)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

7 (edited by rk 2016-10-05 10:07:33)

Re: composer, php-composer & scl

Hi Remi

what's the recommended way to use composer and rhscl php 5.6?

The Composer RPM has standard RHEL Repo php dependencies (php 5.4)...

# yum install composer.noarch
Loaded plugins: package_upload, product-id, search-disabled-repos, subscription-manager
EPEL7                                                                                                     | 2.1 kB  00:00:00
rhel-7-server-rpms                                                                                                  | 2.0 kB  00:00:00
rhel-server-rhscl-7-rpms                                                                                            | 2.0 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package composer.noarch 0:1.2.1-1.el7 will be installed
--> Processing Dependency: php-seld-cli-prompt >= 1.0.0-3 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(symfony/process) >= 2.1 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(symfony/finder) >= 2.2 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(symfony/filesystem) >= 2.5 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(symfony/console) >= 2.5 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(seld/phar-utils) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(seld/jsonlint) >= 1.4 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(seld/cli-prompt) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(psr/log) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(justinrainbow/json-schema) >= 2.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(composer/spdx-licenses) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(composer/semver) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(composer/ca-bundle) >= 1.0 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-PsrLog >= 1.0.0-8 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php(language) >= 5.3.2 for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-zlib for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-zip for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-xsl for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-tokenizer for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-spl for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-simplexml for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-reflection for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-phar for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-pcre for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-openssl for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-mbstring for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-libxml for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-json for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-intl for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-iconv for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-hash for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-filter for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-dom for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-date for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-curl for package: composer-1.2.1-1.el7.noarch
--> Processing Dependency: php-composer(symfony/class-loader) for package: composer-1.2.1-1.el7.noarch

I already tried the following: "download-only" the composer package and installed it without deps. Unfortunately it doesn't work, as the composer is looking for files in standard php path:

# composer --help
PHP Warning:  require_once(/usr/share/php/Symfony/Component/ClassLoader/ClassLoader.php): failed to open stream: No such file or directory in /usr/share/php/Composer/autoload.php on line 8
PHP Fatal error:  require_once(): Failed opening required '/usr/share/php/Symfony/Component/ClassLoader/ClassLoader.php' (include_path='.:/opt/rh/rh-php56/root/usr/share/pear:/opt/rh/rh-php56/root/usr/share/php') in /usr/share/php/Composer/autoload.php on line 8

I enabled the current PHP RHSCL version like this:

ln -s /opt/rh/rh-php56/enable /etc/profile.d/rh-php56.sh

I prefere not to install all the dependencies... So is there a way to do so, and also get the composer working? Create another soft link int the /usr/share/php/ dir?

Thanks for your support!

Best Regards,
Rémy

Re: composer, php-composer & scl

> I prefere not to install all the dependencies... So is there a way to do so, and also get the composer working? Create another soft link int the /usr/share/php/ dir?

You MUST install all dependencies wink   (especially all the "noarch" ones)

And it works with the SCL (/usr/bin/composer start with "#!/usr/bin/env php", so use current PHP version)

The only other way is to use the upstream .phar file, instead of the packaged version.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: composer, php-composer & scl

> PHP Fatal error:  require_once(): Failed opening required '/usr/share/php/Symfony/Component/ClassLoader/ClassLoader.php' (include_path='.:/opt/rh/rh-php56/root/usr/share/pear:/opt/rh/rh-php56/root/usr/share/php') in /usr/share/php/Composer/autoload.php on line 8

BTW, this is not the SCL from my repo, but the one from RH.

You have to fix the include path

Exemple, create the /etc/opt/rh/rh-php56/php.d/includepath.ini  file with:

include_path = '.:/opt/rh/rh-php56/root/usr/share/pear:/opt/rh/rh-php56/root/usr/share/php:/usr/share/pear:/usr/share/php'
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: composer, php-composer & scl

In SCL?,  Only build "arched" packages? others options? Thank.

Re: composer, php-composer & scl

@cerrajerosbcn: what is the question ? I  don't understand what you try to ask.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: composer, php-composer & scl

The implication above is that the remi repo'd version of composer should work ok with SCL, but it's definitely causing problems for me.

We run php56 from SCL, but we use alternatives like the following to ensure consistent paths on different php versions.

/usr/sbin/alternatives --install /usr/bin/php php /opt/rh/rh-php56/root/usr/bin/php 3 \
    --slave /usr/bin/pear pear /opt/rh/rh-php56/root/usr/bin/pear \
    --slave /usr/bin/php-cgi php-cgi /opt/rh/rh-php56/root/usr/bin/php-cgi \
    --slave /usr/bin/phpize phpize /opt/rh/rh-php56/root/usr/bin/phpize \
    --slave /usr/bin/pecl pecl /opt/rh/rh-php56/root/usr/bin/pecl \
    --slave /usr/sbin/php-fpm php-fpm /opt/rh/rh-php56/root/usr/sbin/php-fpm \
    --slave /etc/php.ini php-ini /etc/opt/rh/rh-php56/php.ini \
    --slave /etc/php.d php-d /etc/opt/rh/rh-php56/php.d \
    --slave /usr/share/pear pear-dir /opt/rh/rh-php56/root/usr/share/pear \
    --slave /usr/share/php php-dir /opt/rh/rh-php56/root/usr/share/php \
    --slave /etc/init.d/php-fpm php-fpm-init /etc/init.d/rh-php56-php-fpm \
    --slave /etc/php-fpm.conf php-fpm-conf /etc/opt/rh/rh-php56/php-fpm.conf \
    --slave /etc/php-fpm.d php-fpm-d /etc/opt/rh/rh-php56/php-fpm.d \
    --slave /var/log/php-fpm php-fpm-logs /var/opt/rh/rh-php56/log/php-fpm \
    --slave /var/run/php-fpm php-fpm-run /var/opt/rh/rh-php56/run/php-fpm

To get composer to install from the remi repo, I end up having to enable the remi-php56 repo too, e.g:

yum --enablerepo=remi --enablerepo=remi-php56 install composer

Which pulls in a version of the PHP package that clobbers some of the alternatives symlinks.

Is there anyway to work around this (short of pulling in all the packages, deleting the files/directories from the remi-php56 packages and then redoing the alternatives)?

Currently testing on "Scientific Linux release 6.8 (Carbon)" with rh-php56-php-* packages from SCL to get PHP.

Re: composer, php-composer & scl

Sorry, I don't have good solution.

SCL are designed to work with "scl enable" command (per user/project), not with alternatives (global) ...

Packaged applications are desinged to work with base packages, not with SCL
(despite I keep the "/usr/bin/env php" shebang, allowing some of them to work with SCL)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi