LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.39k stars 300 forks source link

Lychee in /opt/Lychee and public is symlinked to /var/www/html/lychee - "server error or API not found" #690

Open cortomalese opened 4 years ago

cortomalese commented 4 years ago

Detailed description of the problem

Hi. After a fresh install of Lychee v4, when I go to web directory (files are in /opt/Lychee and I symlinked public to /var/www/html/lychee) I got this message : "server error or API not found" and a black page I do set database username and password in .env file (like in .env.mariadb.travis), but diagnostic says: "Error: username empty or not set in database and Error: password empty or not set in database I can login in mysql with my lychee user/password and I see lychee database with ten tables created: albums, config, logs, migrations, page_contents, pages, photos, sym_links, user_album and users

This is logs table dump :

"id","type","function","line","text","created_at","updated_at" "1","notice","up","68","lychee_settings does not exist!","2020-08-03 09:36:18","2020-08-03 09:36:18" "2","notice","up","36","lychee_albums does not exist!","2020-08-03 09:36:18","2020-08-03 09:36:18" "3","notice","up","85","lychee_photos does not exist!","2020-08-03 09:36:18","2020-08-03 09:36:18" "4","warning","GenerateInstalledLog::up","18","Installation completed.","2020-08-03 09:36:20","2020-08-03 09:36:20"

And this is configs table dump :

"id","key","value","cat","type_range","confidentiality","description" "1","version","040006","Admin","int","0","" "2","username","","Admin","string_required","4","" "3","password","","Admin","string_required","4","" "4","check_for_updates","0","Admin","0|1","0","" "5","sorting_Photos_col","takestamp","Gallery","id|takestamp|title|description|public|star|type","2","" "6","sorting_Photos_order","ASC","Gallery","ASC|DESC","2","" "7","sorting_Albums_col","max_takestamp","Gallery","id|title|description|public|max_takestamp|min_takestamp|created_at","0","" "8","sorting_Albums_order","ASC","Gallery","ASC|DESC","0","" "9","imagick","1","Image Processing","0|1","2","" "10","dropbox_key","","Admin","string","3","" "11","skip_duplicates","0","Image Processing","0|1","2","" "12","small_max_width","0","Image Processing","int","2","" "13","small_max_height","360","Image Processing","int","2","" "14","medium_max_width","1920","Image Processing","int","2","" "15","medium_max_height","1080","Image Processing","int","2","" "16","lang","en","Gallery","","0","" "17","layout","1","Gallery","0|1|2","0","" "18","image_overlay","1","Gallery","0|1","0","" "19","image_overlay_type","desc","Gallery","exif|desc|takedate","0","" "20","default_license","none","Gallery","string_required","2","" "21","compression_quality","90","Image Processing","int","2","" "22","full_photo","1","Gallery","0|1","0","" "23","delete_imported","0","Image Processing","0|1","2","" "24","Mod_Frame","1","Mod Frame","0|1","0","" "25","Mod_Frame_refresh","30","Mod Frame","int","0","" "26","thumb_2x","1","Image Processing","0|1","2","" "27","small_2x","1","Image Processing","0|1","2","" "28","medium_2x","1","Image Processing","0|1","2","" "29","landing_page_enable","0","Mod Welcome","0|1","0","" "30","landing_owner","John Smith","Mod Welcome","string","2","" "31","landing_title","John Smith","Mod Welcome","string","2","" "32","landing_subtitle","Cats, Dogs & Humans Photography","Mod Welcome","string","2","" "33","landing_facebook","https://www.facebook.com/JohnSmith","Mod Welcome","string","2","" "34","landing_flickr","https://www.flickr.com/JohnSmith","Mod Welcome","string","2","" "35","landing_twitter","https://www.twitter.com/JohnSmith","Mod Welcome","string","2","" "36","landing_instagram","https://instagram.com/JohnSmith","Mod Welcome","string","2","" "37","landing_youtube","https://www.youtube.com/JohnSmith","Mod Welcome","string","2","" "38","landing_background","dist/cat.jpg","Mod Welcome","string","2","" "39","site_title","Lychee v4","config","string","0","" "40","site_copyright_enable","1","config","0|1","2","" "41","site_copyright_begin","2019","config","int","2","" "42","site_copyright_end","2019","config","int","2","" "43","api_key","","Admin","string","3","" "44","allow_online_git_pull","1","Admin","0|1","3","" "45","force_migration_in_production","0","Admin","0|1","3","" "46","additional_footer_text","","config","string","2","" "47","display_social_in_gallery","0","config","0|1","2","" "48","public_search","0","config","0|1","0","" "49","gen_demo_js","0","Admin","0|1","3","" "50","hide_version_number","0","config","0|1","3","" "51","SL_enable","0","Symbolic Link","0|1","2","" "52","SL_for_admin","0","Symbolic Link","0|1","2","" "53","SL_life_time_days","7","Symbolic Link","int","3","" "54","public_recent","0","Smart Albums","0|1","0","" "55","recent_age","1","Smart Albums","int","2","" "56","public_starred","0","Smart Albums","0|1","0","" "57","downloadable","0","config","0|1","0","" "58","photos_wraparound","1","Gallery","0|1","0","" "59","raw_formats",".tex","config","","3","" "60","map_display","0","Mod Map","0|1","0","" "61","zip64","1","config","0|1","0","" "62","map_display_public","0","Mod Map","0|1","0","" "63","map_provider","Wikimedia","Mod Map","Wikimedia|OpenStreetMap.org|OpenStreetMap.de|OpenStreetMap.fr|RRZE","0","" "64","force_32bit_ids","0","config","0|1","0","" "65","map_include_subalbums","0","Mod Map","0|1","0","" "66","update_check_every_days","3","config","int","2","" "67","has_exiftool","0","Image Processing","0|1|2","2","" "68","share_button_visible","0","config","0|1","0","" "69","import_via_symlink","0","Image Processing","0|1","2","" "70","has_ffmpeg","0","Image Processing","0|1|2","2","" "71","apply_composer_update","0","Admin","0|1","3","" "72","location_decoding","0","Mod Map","0|1","0","" "73","location_decoding_timeout","30","Mod Map","int","0","" "74","location_show","1","Mod Map","0|1","0","" "75","location_show_public","0","Mod Map","0|1","0","" "76","rss_enable","0","Mod RSS","0|1","0","" "77","rss_recent_days","7","Mod RSS","int","0","" "78","rss_max_items","100","Mod RSS","int","0","" "79","prefer_available_xmp_metadata","0","Image Processing","0|1","2",""

Steps to reproduce the issue

On fresh install, from zip archive or with git method. Apache web server. Files are in /opt/Lychee and I symlinked public to /var/www/html/lychee

Output of the diagnostics (Settings => Diagnostics)

Diagnostics

Info: Latest version of PHP is 7.4 Warning: Using 32 bit PHP, recommended upgrade to 64 bit Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details. Error: username empty or not set in database Error: password empty or not set in database Warning: Dropbox import not working. dropbox_key is empty.

System Information

Lychee Version (git): master (ff548e9) - Data not in Cache DB Version: 4.0.6

composer install: --no-dev APP_ENV: production APP_DEBUG: false

System: Linux PHP Version: 7.3 Max uploaded file size: 2M Max post size: 8M MySQL Version: 10.3.23-MariaDB-0+deb10u1

Imagick: 1 Imagick Active: 1 Imagick Version: 1690 GD Version: 2.2.5

Config Information

version: 040006 check_for_updates: 0 sorting_Photos_col: takestamp sorting_Photos_order: ASC sorting_Albums_col: max_takestamp sorting_Albums_order: ASC 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: 1 image_overlay_type: desc 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: 0 landing_owner: John Smith landing_title: John Smith landing_subtitle: Cats, Dogs & Humans Photography landing_facebook: https://www.facebook.com/JohnSmith landing_flickr: https://www.flickr.com/JohnSmith landing_twitter: https://www.twitter.com/JohnSmith landing_instagram: https://instagram.com/JohnSmith landing_youtube: https://www.youtube.com/JohnSmith landing_background: dist/cat.jpg site_title: Lychee v4 site_copyright_enable: 1 site_copyright_begin: 2019 site_copyright_end: 2019 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: Wikimedia force_32bit_ids: 0 map_include_subalbums: 0 update_check_every_days: 3 has_exiftool: 0 share_button_visible: 0 import_via_symlink: 0 has_ffmpeg: 0 location_decoding: 0 location_decoding_timeout: 30 location_show: 1 location_show_public: 0 rss_enable: 0 rss_recent_days: 7 rss_max_items: 100 prefer_available_xmp_metadata: 0

Browser and system

Firefox or Chromium Raspbian Buster

jamesautodude commented 4 years ago

Same issue as me pretty much! Hopefully someone figures out a fix

d7415 commented 4 years ago

My immediate thought here is "does the web server / PHP have access to /opt/Lychee?" They're often chrooted so wouldn't be able to follow such a symlink.

cortomalese commented 4 years ago

Thanks for your reply Martin.

The whole tree from /opt/Lychee onwards belongs to www-data:www-data . I have the same problem if Lychee tree is in /var/www/html and /Lychee/public symlinked to lychee.

Lychee-front is empty: is this normal?

Have a good day, Corto

d7415 commented 4 years ago

Ok. Thanks for trying.

Lychee-front is empty: is this normal?

That's fine - Lychee-front is compiled into files in public/dist/ rather than being accessed directly.

kamil4 commented 4 years ago

I have the same initial reaction as @d7415 although the fact that you get the "server error or API not found" indicates that the web server was able to load the front end at least... And since, as you said, moving Lychee to /var/www/html didn't fix it, I guess the issue must be different...

Can you edit .env, switch APP_ENV to local, APP_DEBUG to true, and for a good measure, DB_LOG_SQL to true? The Lychee server should then generate a log file on next access under storage/logs/laravel.log. Are there any errors in that log? Maybe just recreate the "server error or API not found" message and send us the log; hopefully it won't be too large...

@jamesautodude No, this is a very different problem than yours...

cortomalese commented 4 years ago

Hi @kamil4 . Maybe it is better I reply in the forum. Here is logfile, according with your instructions laravel.log

kamil4 commented 4 years ago

Unfortunately, I don't see anything in the log that would reveal what the problem might be...

cortomalese commented 4 years ago

Thank you @kamil4 , I'll try again.

cortomalese commented 4 years ago

Ok. I download latest Lychee.zip, unzip it in /var/www/html, create a /var/www/html/lychee symlink from Lychee/public. Then

cp .env.example .env edit .env php artisan key:generate php artisan migrate -> "nothing to migrate" sudo chown -R www-data:www-data . And I got "server error or API not found". Deleted .env and acces from my browser the Lychee installation http://homeserver/lychee. It go in http://homeserver/lychee/install/ directory and I got "Not Found. The requested URL was not found on this server." And, really, I have a lychee/installer directory, but no http://homeserver/lychee/install/ at all. Thanks for help me.

jobsoftinc commented 3 years ago

This step was not included in the Apache instructions: in /etc/httpd/conf/httpd.conf (or /etc/httpd/conf.d/ssl.conf or whatever applies to you):

` < VirtualHost lychee.youdom.com:443> ...

DocumentRoot "/var/www/html/Lychee/public" ServerName https://lychee.youdom.com:443 ...

< Directory /var/www/html/Lychee/> Options FollowSymLinks AllowOverride All Order allow,deny allow from all < /Directory> ... < /VirtualHost>

`

I followed all of the install steps for Centos 7 and apache and got the same error as @cortomalese, but was looking at another post for setting up Lychee on Centos with apache on a VPS service where they showed adding the above Directory directive for whatever virtual host Lychee was being setup under. As soon as I added the above and restarted httpd, it started working fine.