Closed oblomow closed 2 years ago
Your problem seems to have a complete different cause. Migration fails not due your DB being inconsistent, but because Kalnoy\Nestedset\Node
is missing (cp. 3rd line from below). In turn, this is the case because upgrading the package dependencies via composer install --no-dev
fails with an exception. The interesting part is
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies from lock file
PHP Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/sharephp/Composer/DependencyResolver/DefaultPolicy.php:84
Unfortunately, I am not a composer expert. But I would recommend
composer
as the super-user (root user). It is important to run composer as the same user which executes the PHP files later, most likely this will be the user which also runs the process of your web-server. On most systems this is either www-data
or apache
or nginx
(depending on your distribution and webserver). Otherwise composer downloads all package files with the wrong ownership and Lychee won't be able to load them. As a safety measure I usually recommend something like this cd ~www-data; sudo -u www-data /bin/bash
and therewith execute all Lychee/Artisan/GIT command within a shell that is owned by the correct user../vendor
directory, chown
all files in the Lychee directory to the correct user recursively and then re-run composer install --no-dev
, but this time with the correct user (see above). Probably this should fix the issue.Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters
might also indicate that your composer version is too old for PHP 8. Before you install the dependencies, run a composer self-update via composer self-update
.Must have missed running it as www-data user on a previous update and it seems to have broken. I do a backup and will run the commands you said, while being careful of the user. Thanks for your hellp, I will report soon.
Seems like the composer verion on debian 10, in repositories is version 1.x and we need 2.x. Can you please confirm that ? If that's the case, I'll need to update that, and maybe you'll need to put checks on composer version in Leechy.
Yes, I can confirm.
Generally, it is not recommended to use a system-wide composer executable. Even on a rolling-release system like mine (Gentoo), these packages are ridiculously out-dated. Usually, you should use a local, project-specific composer installation. I try to provide you the necessary steps. If this still does not help, we should take this conversation to Gitter. We should stop to hijack this thread. Your problem has nothing to do with the problem of the OP. In particular it is not a Lychee issue, but your personal problem due to an ancient server installation ;-)
No worries, I updated Composer myself and doing tests. I should be ok. If you have no news from me, assume, it went nicely. Sorry for the thread hijack.
I assume that your installation resides in /var/www/html/lychee
and that your apache user is www-data
. If not, adopt accordingly.
sudo apt-get remove composer
(Optional, but recommended).
De-install your system-wide installation of composer
. Most mature PHP packages (like Nextcloud, etc.) do not need it, because they ship with their own version. Uninstalling composer
prevents you from accidentally running the system-wide version if you forget to put ./
in front of the composer command and thereby breaking things again. However, I don't know if you have any Debian packages which actually require a system-wide composer. So look out for any related messages returned by apt-get remove
.
cd /var/wwwhtml/lychee/vendor
followed by sudo rm -rf *
Nuke the vendor directory
cd ..
followed by sudo chown -R www-data:www-data *
Move one level up to the Lychee main directory and make everything owned by www-data
.
sudo -u www-data /bin/bash
From here on, we do everything in a shell owned by the www-data
user.
Run the following lines as instructed by https://getcomposer.org/download/
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
This will install a local, project-specific version of composer into the Lychee main directory
git checkout master
, git pull
and git reset --hard master
Make sure you have the latest version of master and a clean working copy.
./composer install --no-dev
Install all dependencies; checkout for any errors. Please note, the ./
in the beginning. This ensures that you run the correct version of composer
.
./artisan migrate
Migrate your database. Please make sure you have a backup.
exit
Leaves the shell owned by www-data
Thanks for the guide. I updated composer manualy and updated components. then ran the update and all went well at first glance. Thanks for your time ! If I have other problems i'll create a new issue.
I assume that your installation resides in
/var/www/html/lychee
and that your apache user iswww-data
. If not, adopt accordingly.1. `sudo apt-get remove composer` (Optional, but recommended).
...
Thank you @nagmat84 - can you please add this fix to the Wiki or main Doc site as it affected me and probably others as well?
Detailed description of the problem
Updating breaks Lychee. ( thank $deity for backups and databasedumps)
Steps to reproduce the issue
Steps to reproduce the behavior:
Screenshots If applicable, add screenshots to help explain your problem.
Output of the diagnostics
Diagnostics
Info: Latest version of PHP is 8.1
System Information
Lychee Version (git): master (a7de020) - Up to date (13 hours ago). DB Version: 4.4.0
composer install: --no-dev APP_ENV: local APP_DEBUG: false
System: FreeBSD PHP Version: 8 PHP User agent: Lychee/4 (https://lycheeorg.github.io/) Max uploaded file size: 100M Max post size: 100M Max execution time: 0 MySQL Version: 8.0.27
Imagick: 1 Imagick Active: 1 Imagick Version: 1692 GD Version: 2.3.1
Config Information
version: 040400 check_for_updates: 1 sorting_Photos_col: taken_at sorting_Photos_order: ASC sorting_Albums_col: title sorting_Albums_order: DESC imagick: 1 skip_duplicates: 0 small_max_width: 0 small_max_height: 360 medium_max_width: 1920 medium_max_height: 1080 lang: en layout: 1 image_overlay_type: date default_license: none compression_quality: 90 full_photo: 1 delete_imported: 0 Mod_Frame: 1 Mod_Frame_refresh: 30 thumb_2x: 1 small_2x: 1 medium_2x: 1 landing_page_enable: 1 landing_owner: Marc landing_title: Marc landing_subtitle: Why stop now? landing_facebook: landing_flickr: landing_twitter: landing_instagram: landing_youtube: landing_background: dist/finland.jpg site_title: fotos site_copyright_enable: 1 site_copyright_begin: 1984 site_copyright_end: 2021 additional_footer_text:
display_social_in_gallery: 0 public_search: 0 SL_enable: 0 SL_for_admin: 0 public_recent: 0 recent_age: 1 public_starred: 0 downloadable: 0 photos_wraparound: 1 map_display: 0 zip64: 1 map_display_public: 0 map_provider: OpenStreetMap.org force_32bit_ids: 0 map_include_subalbums: 0 update_check_every_days: 3 has_exiftool: 1 share_button_visible: 0 import_via_symlink: 0 has_ffmpeg: 0 location_decoding: 0 location_decoding_timeout: 30 location_show: 0 location_show_public: 0 rss_enable: 0 rss_recent_days: 7 rss_max_items: 100 prefer_available_xmp_metadata: 0 editor_enabled: 1 lossless_optimization: 0 swipe_tolerance_x: 150 swipe_tolerance_y: 250 local_takestamp_video_formats: .avi|.mov log_max_num_line: 1000 unlock_password_photos_with_url_param: 0 nsfw_visible: 1 nsfw_blur: 0 nsfw_warning: 0 nsfw_warning_admin: 0 map_display_direction: 1 album_subtitle_type: oldstyle upload_processing_limit: 4 public_photos_hidden: 1 new_photos_notification: 0
Browser and system
Browser: Firefox 96.0