PHPCI icon indicating copy to clipboard operation
PHPCI copied to clipboard

Composer weirdness

Open zippy1981 opened this issue 10 years ago • 11 comments

My daemonise builds were failing with Could not find composer I have phpci in /usr/local/phpcu like so

bash-4.3$ ls -l /usr/local/phpci
total 3656
lrwxrwxrwx    1 jdearing 0                60 Mar 16 11:43 composer -> /usr/local/phpci/composer.phar
-rwxr-xr-x    1 jdearing 0           1569240 Feb 27 23:47 composer.phar
drwxr-sr-x    8 jdearing 0             24576 Mar 16 11:52 phpci
-rw-r--r--    1 jdearing 0                 6 Mar 16 14:22 phpci.daemonise.pid
bash-4.3$ ls -l /usr/local/phpci/phpci
total 872
-rw-r--r--    1 jdearing 0               699 Feb 27 23:51 Dockerfile
-rw-r--r--    1 jdearing 0              1296 Feb 27 23:51 LICENSE.md
drwxr-sr-x   14 jdearing 0             24576 Feb 28 22:17 PHPCI
-rw-r--r--    1 jdearing 0              1929 Feb 27 23:51 README.md
drwxr-sr-x    4 jdearing 0              8192 Feb 27 23:51 Tests
-rw-r--r--    1 jdearing 0              2486 Feb 27 23:51 bootstrap.php
lrwxrwxrwx    1 jdearing 0                60 Mar 16 11:52 composer -> /usr/local/phpci/composer.phar
-rw-r--r--    1 jdearing 0              2292 Feb 27 23:51 composer.json
-rw-r--r--    1 jdearing 0             72402 Feb 27 23:51 composer.lock
-rwxr-xr-x    1 jdearing 0              1219 Feb 27 23:51 console
drwxr-sr-x    2 jdearing 0              8192 Feb 29 16:25 daemon
-rwxr-xr-x    1 jdearing 0               610 Feb 27 23:51 daemonise
-rw-r--r--    1 jdearing 0               174 Mar 16 14:22 daemonise.sh
-rw-r--r--    1 jdearing 0             73342 Mar 16 14:14 errors.log
-rw-r--r--    1 jdearing 0             15909 Feb 28 23:57 everything-2016-02-28
-rw-r--r--    1 jdearing 0              1310 Feb 29 16:23 everything-2016-02-29
-rw-r--r--    1 jdearing 0               487 Feb 28 23:26 loggerconfig.php
-rw-r--r--    1 jdearing 0               488 Feb 27 23:51 loggerconfig.php.example
-rw-------    1 jdearing 0               544 Mar 16 14:06 nohup.out
-rw-r--r--    1 jdearing 0               718 Feb 27 23:51 phinx.php
-rw-r--r--    1 jdearing 0               902 Feb 27 23:51 phpci.yml
-rw-r--r--    1 jdearing 0              1305 Feb 27 23:51 phpunit.xml
-rw-r--r--    1 jdearing 0               746 Feb 27 23:51 pluginconfig.php.example
drwxr-sr-x    3 jdearing 0              8192 Mar  7 16:54 public
-rw-r--r--    1 jdearing 0               861 Feb 27 23:51 vars.php
drwxr-sr-x   22 jdearing 0             24576 Feb 28 00:01 vendor

Even with /usr/local/phpci in my path I needed the composer symlink in /usr/local/phpci/phpci I am starting daemonise with this shell script:

#!/usr/bin/bash

cd /usr/local/phpci/phpci
PATH=/usr/local/phpci:$PATH
nohup php ./daemonise phpci:daemonise >/dev/null 2>&1 & echo $! > /usr/local/phpci/phpci/phpci.daemonise.pid

zippy1981 avatar Mar 16 '16 19:03 zippy1981

What version are you running? The 1.7.0 (I believe) stops using executables on the filesystem (/usr/local/phpci/composer) and instead uses them relative to the build (they must be in the root of your project folder)

GenericStudent avatar Mar 20 '16 17:03 GenericStudent

Why that is really silly ? Why do i need to have composer inside of my project/

cerw avatar Sep 01 '16 11:09 cerw

Uh that isn't what it does, it looks for the tools in the projects vendor/bin folder or in the global $PATH, it just doesn't look for them in PHPCI's vendor/bin folder anymore

https://github.com/Block8/PHPCI/blob/master/PHPCI/Helper/BaseCommandExecutor.php#L150-L187

REBELinBLUE avatar Sep 01 '16 12:09 REBELinBLUE

Yeah I just debuged it on my server and still getting errors, it looks like it's not looking for $PATH anymore..

xception: Could not find composer/composer.phar {"exception":"[object] (Exception(code: 0): Could not find composer/composer.phar at /home/phpci/app/PHPCI/Helper/BaseCommandExecutor.php:187)","buildID":"3918"} []

cerw avatar Sep 01 '16 12:09 cerw

https://github.com/Block8/PHPCI/blob/master/PHPCI/Helper/UnixCommandExecutor.php but that is what it does.

What do you get if you run $ which composer or $ which composer.phar as the user you have the queue worker running as?

REBELinBLUE avatar Sep 01 '16 12:09 REBELinBLUE

phpci@logs:~$ id
uid=1004(phpci) gid=1007(phpci) groups=1007(phpci),33(www-data)
phpci@logs:~$ which composer
/usr/local/bin/composer
phpci@logs:~$ 

cerw avatar Sep 02 '16 02:09 cerw

@REBELinBLUE anything? is it just me?

cerw avatar Sep 05 '16 07:09 cerw

screenshot 2016-09-06 09 44 01

cerw avatar Sep 06 '16 01:09 cerw

Are you absolutely sure you have the worker running as the user phpci? Can you try creating a symlink from /usr/local/bin/composer to /usr/bin/composer

REBELinBLUE avatar Sep 06 '16 09:09 REBELinBLUE

symlink fixed it! strange. even that which still return same ..

cerw avatar Sep 07 '16 05:09 cerw

Hmm, odd

REBELinBLUE avatar Sep 07 '16 13:09 REBELinBLUE