dreadnaut / PHPloy

PHPloy - Incremental Git (S)FTP deployment tool that supports multiple servers, submodules and rollbacks.
http://wplancer.com/phploy/
9 stars 1 forks source link

Install by composer does not work #1

Closed tomasr1981 closed 6 days ago

tomasr1981 commented 2 months ago

Hi, I installed by instructions in readme: composer global require dreadnaut/phploy:dev-master

But it does not work:

Changed current directory to /home/username/.config/composer
./composer.json has been updated
Running composer update dreadnaut/phploy
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - league/flysystem-sftp-v3[3.0.0, ..., 3.28.0] require phpseclib/phpseclib ^3.0 -> found phpseclib/phpseclib[3.0.0, ..., 3.0.37] but the package is fixed to 2.0.47 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - dreadnaut/phploy dev-master requires league/flysystem-sftp-v3 ^3.0 -> satisfiable by league/flysystem-sftp-v3[3.0.0, ..., 3.28.0].
    - Root composer.json requires dreadnaut/phploy dev-master -> satisfiable by dreadnaut/phploy[dev-master].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
dreadnaut commented 2 weeks ago

Hello @tomasr1981, and apologies for the delay – I missed the notification 😞

The problem seem to be a locked version:

  • league/flysystem-sftp-v3[3.0.0, ..., 3.28.0] require phpseclib/phpseclib ^3.0 -> found phpseclib/phpseclib[3.0.0, ..., 3.0.37] but the package is fixed to 2.0.47 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

You'll have to check your installed packages using composer global show --tree , and see which other package currently locks phpseclib/phpseclib to version 2.

tomasr1981 commented 2 weeks ago

Hello @dreadnaut , command which you notice return:

4.9.3 PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.
β”œβ”€β”€league/climate ^3.0
β”‚  β”œβ”€β”€php ^7.3 || ^8.0
β”‚  β”œβ”€β”€psr/log ^1.0 || ^2.0 || ^3.0
β”‚  β”‚  └──php >=5.3.0
β”‚  └──seld/cli-prompt ^1.0
β”‚     └──php >=5.3
β”œβ”€β”€league/flysystem ^1.0
β”‚  β”œβ”€β”€ext-fileinfo *
β”‚  β”œβ”€β”€league/mime-type-detection ^1.3
β”‚  β”‚  β”œβ”€β”€ext-fileinfo *
β”‚  β”‚  └──php ^7.4 || ^8.0
β”‚  └──php ^7.2.5 || ^8.0
β”œβ”€β”€league/flysystem-sftp ^1.0
β”‚  β”œβ”€β”€league/flysystem ~1.0
β”‚  β”‚  β”œβ”€β”€ext-fileinfo *
β”‚  β”‚  β”œβ”€β”€league/mime-type-detection ^1.3
β”‚  β”‚  β”‚  β”œβ”€β”€ext-fileinfo *
β”‚  β”‚  β”‚  └──php ^7.4 || ^8.0
β”‚  β”‚  └──php ^7.2.5 || ^8.0
β”‚  β”œβ”€β”€php >=5.6.0
β”‚  └──phpseclib/phpseclib ~2.0
β”‚     └──php >=5.3.3
└──php ^7.3

What can I do with it?

dreadnaut commented 2 weeks ago

Seems like you still have the original PHPloy installed, which locks an old version of the SFTP library and causes the error you see

4.9.3 PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.
[ ... ]
> β”œβ”€β”€league/flysystem-sftp ^1.0

Before you install dreadnaut/phploy, you should remove banago/phploy (or the version that you are using). Probably something like:

composer global remove banago/phploy

If you are uncertain about the package installed, you can get the list with composer global show.

Once you have uninstalled the old version, the command in your first message should work πŸš€

tomasr1981 commented 2 weeks ago

Hello @dreadnaut, great, instalation looks like good, but command phploy is unknown.

composer global require dreadnaut/phploy:dev-master
Changed current directory to /home/tomasr/.config/composer
./composer.json has been updated
Running composer update dreadnaut/phploy
Loading composer repositories with package information
Updating dependencies
Lock file operations: 12 installs, 0 updates, 0 removals
  - Locking dreadnaut/phploy (dev-master 466f2bf)
  - Locking league/climate (3.8.2)
  - Locking league/flysystem (3.28.0)
  - Locking league/flysystem-ftp (3.28.0)
  - Locking league/flysystem-local (3.28.0)
  - Locking league/flysystem-sftp-v3 (3.28.0)
  - Locking league/mime-type-detection (1.15.0)
  - Locking paragonie/constant_time_encoding (v3.0.0)
  - Locking paragonie/random_compat (v9.99.100)
  - Locking phpseclib/phpseclib (3.0.39)
  - Locking psr/log (3.0.0)
  - Locking seld/cli-prompt (1.0.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
  - Downloading paragonie/random_compat (v9.99.100)
  - Downloading paragonie/constant_time_encoding (v3.0.0)
  - Downloading phpseclib/phpseclib (3.0.39)
  - Downloading league/flysystem (3.28.0)
  - Downloading league/flysystem-local (3.28.0)
  - Downloading league/flysystem-sftp-v3 (3.28.0)
  - Downloading league/flysystem-ftp (3.28.0)
  - Downloading dreadnaut/phploy (dev-master 466f2bf)
  - Installing paragonie/random_compat (v9.99.100): Extracting archive
  - Installing paragonie/constant_time_encoding (v3.0.0): Extracting archive
  - Installing phpseclib/phpseclib (3.0.39): Extracting archive
  - Installing league/mime-type-detection (1.15.0): Extracting archive
  - Installing league/flysystem (3.28.0): Extracting archive
  - Installing league/flysystem-local (3.28.0): Extracting archive
  - Installing league/flysystem-sftp-v3 (3.28.0): Extracting archive
  - Installing league/flysystem-ftp (3.28.0): Extracting archive
  - Installing seld/cli-prompt (1.0.4): Extracting archive
  - Installing psr/log (3.0.0): Extracting archive
  - Installing league/climate (3.8.2): Extracting archive
  - Installing dreadnaut/phploy (dev-master 466f2bf): Extracting archive
4 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
user@computer:~$ phploy
"phploy" command not found, you may have meant:
 "phploc" command from deb package phploc (7.0.2-2)
Try: sudo apt install <deb package name>
dreadnaut commented 2 weeks ago

Not sure how you set up Composer, but "global" tools are usually installed in the ~/.config/composer/vendor/bin/ directory. To be able to call them directly, you need to add the path to your $PATH shell variable.

Something like this:

export PATH=~/.composer/vendor/bin:$PATH

That line can also go in you profile script, so it's always run when you open a terminal. See if you can find a guide for your specific operating system.

After running the export command, all Composer tools will be reachable without using the full path.

tomasr1981 commented 2 weeks ago

Hello @dreadnaut, I cannot manage it. No guide works for me and result is the same before and after using last command.

composer global require dreadnaut/phploy:dev-master
Changed current directory to /home/user/.config/composer
./composer.json has been updated
Running composer update dreadnaut/phploy
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
user@computer:~$ phploy
"phploy" command not found, you may have meant:
  "phploc" command from deb package phploc (7.0.2-2)
Try: sudo apt install <deb package name>
user@computer:~$ export PATH=~/.composer/vendor/bin:$PATH
user@computer:~$ phploy
"phploy" command not found, you may have meant:
  "phploc" command from deb package phploc (7.0.2-2)
Try: sudo apt install <deb package name>
dreadnaut commented 2 weeks ago

I think the log is giving you the correct directory when it says

Changed current directory to /home/user/.config/composer

Could you have a look in there, and see if there is a vendor/bin directory in there, with phploy inside? If that's the case, that's what you need to set as PATH:

export PATH=/home/user/.config/composer/vendor/bin:$PATH
dreadnaut commented 1 week ago

Any luck with the above ☝️ , @tomasr1981?

tomasr1981 commented 1 week ago

Hello @dreadnaut,, sorry for the late response, I was away. The phploy file is located in the directory you mention. If I start the export (in the exact wording) in the terminal, then the phploy command turns out the same as before. I hope I apply your advice correctly.

user@computer:~$ export PATH=/home/user/.config/composer/vendorbin:$PATH
user@computer:~$ phploy
"phploy" command not found, you may have meant:
  "phploc" command from deb package phploc (7.0.2-2)
Try: sudo apt install <deb package name>
dreadnaut commented 1 week ago
user@computer:~$ export PATH=/home/user/.config/composer/vendorbin:$PATH

Looks like there's a / missing between vendor and bin. Should be:

export PATH=/home/user/.config/composer/vendor/bin:$PATH

Silly question, but just to be safe: are you also replacing user with your actual username?

tomasr1981 commented 6 days ago

Hello @dreadnaut, it was missing /. Actual username is correct. Now, I can call phploy, but I have error:

PHP Fatal error:  Uncaught TypeError: League\Flysystem\Ftp\FtpConnectionOptions::__construct(): Argument #5 ($port) must be of type int, string given, called in /home/user/.config/composer/vendor/league/flysystem-ftp/FtpConnectionOptions.php on line 107 and defined in /home/user/.config/composer/vendor/league/flysystem-ftp/FtpConnectionOptions.php:11
Stack trace:
#0 /home/user/.config/composer/vendor/league/flysystem-ftp/FtpConnectionOptions.php(107): League\Flysystem\Ftp\FtpConnectionOptions->__construct()
#1 /home/user/.config/composer/vendor/dreadnaut/phploy/src/Connection.php(92): League\Flysystem\Ftp\FtpConnectionOptions::fromArray()
#2 /home/user/.config/composer/vendor/dreadnaut/phploy/src/Connection.php(37): Banago\PHPloy\Connection->connectToFtp()
#3 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(830): Banago\PHPloy\Connection->__construct()
#4 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(884): Banago\PHPloy\PHPloy->connect()
#5 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(339): Banago\PHPloy\PHPloy->deploy()
#6 /home/user/.config/composer/vendor/dreadnaut/phploy/bin/phploy(14): Banago\PHPloy\PHPloy->__construct()
#7 /home/user/.config/composer/vendor/bin/phploy(119): include('...')
#8 {main}
  thrown in /home/user/.config/composer/vendor/league/flysystem-ftp/FtpConnectionOptions.php on line 11

I remind that I use PHP 8.2

dreadnaut commented 6 days ago

Whops, that's a bug! Thank you, should be fixed by https://github.com/dreadnaut/PHPloy/commit/e5e4c858352676ebe17e210354528a910740c909. You can get the new version with

composer global update dreadnaut/phploy
tomasr1981 commented 6 days ago

It is better, but still is fatal error there:

PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, League\Flysystem\DirectoryListing given in /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php:1415
Stack trace:
#0 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(1415): count()
#1 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(952): Banago\PHPloy\PHPloy->purge()
#2 /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php(339): Banago\PHPloy\PHPloy->deploy()
#3 /home/user/.config/composer/vendor/dreadnaut/phploy/bin/phploy(14): Banago\PHPloy\PHPloy->__construct()
#4 /home/user/.config/composer/vendor/bin/phploy(119): include('...')
#5 {main}
  thrown in /home/user/.config/composer/vendor/dreadnaut/phploy/src/PHPloy.php on line 1415
dreadnaut commented 6 days ago

Neat, that something we had missed in the first clean up. Should be fixed as well πŸŽ‰

tomasr1981 commented 6 days ago

Now it is without errors. Thanks for patient.

dreadnaut commented 6 days ago

Thank you for your help, two bugs solved!