Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Lychee Photo Server & PHP exif

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
jlpoole
Guru
Guru
User avatar
Posts: 495
Joined: Tue Nov 01, 2005 5:07 am
Location: Salem, OR

Lychee Photo Server & PHP exif

  • Quote

Post by jlpoole » Sun May 15, 2022 6:25 am

I installed Lychee (https://github.com/LycheeOrg/Lychee) to publish my photography; it seemed very clean and fit the bill for what I wanted: something simple that just works.

Things were going fine until I decided to try uploading JPEGs with EXIF data in them. Then uploads failed.

I'm posting here because I checked the PHP USE flags and the "exif" flag was activated. However, that is not enough, you also have to install a client tool, e.g. media-libs/exiftool.

So, Gentoo users who wonder why your EXIFs are not being read when the PHP USE flag has "exif" activated: the lesson is you need to also have a client exif tool installed.

See also: https://github.com/LycheeOrg/Lychee/issues/461

And, I recommend Lychee if you are a photographer and want to publish photos and have a web site that makes it easy to upload from your desktop or phone.
Top
Hu
Administrator
Administrator
Posts: 24391
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun May 15, 2022 3:38 pm

This seems like something that could be fixed by a dependency in the Lychee ebuild. Add RDEPEND="exif? ( media-libs/exiftool )", or append that string to an existing RDEPEND if one exists. I couldn't readily find an ebuild for Lychee in ::gentoo or in the linked repository, so I cannot say what file needs to be patched for this.
Top
jlpoole
Guru
Guru
User avatar
Posts: 495
Joined: Tue Nov 01, 2005 5:07 am
Location: Salem, OR

  • Quote

Post by jlpoole » Sun May 15, 2022 4:53 pm

I did not use an ebuild for Lychee, I installed it with GIT. Lychee states that it requires PHP to have exif enabled. I looked at my install of PHP and saw I had the exif flag activated. What I did not know is that does not necessarily mean that exif will work in PHP. So I thought I'd post to this forum since it is unsupported and if anyone does a search for Lychee, they'll see this subtle point. Thank you for trying to look for the ebuild and come up with a solution if there had been one.
Top
Banana
Administrator
Administrator
User avatar
Posts: 2387
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Tue May 17, 2022 6:50 am

Exif for PHP does not need any further software: http://php.adamharvey.name/manual/en/ex ... ements.php

It sounds like Lychee does call the exiftool directly, so Hu is correct. The dependency should be handled from Lychee itself. But since you install it not with portage, there is nothing much gentoo can do for you.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
jlpoole
Guru
Guru
User avatar
Posts: 495
Joined: Tue Nov 01, 2005 5:07 am
Location: Salem, OR

  • Quote

Post by jlpoole » Tue May 17, 2022 10:39 am

Banana wrote:Exif for PHP does not need any further software: http://php.adamharvey.name/manual/en/ex ... ements.php

It sounds like Lychee does call the exiftool directly, so Hu is correct. The dependency should be handled from Lychee itself. But since you install it not with portage, there is nothing much gentoo can do for you.
I was not asking Gentoo to do anything fore me. However, your link, http://php.adamharvey.name/manual/en/ex ... ements.php ,
does reveal another subtlety. EXIF must have mbstring installed.
To enable multibyte support in EXIF tags, the mbstring extension must be enabled by compiling PHP with --enable-mbstring.
It turns out, my installation has:

Code: Select all

# eix -I php
[I] app-eselect/eselect-php
     Available versions:  0.9.6 0.9.7 ~0.9.7-r1 0.9.8 **9999*l {apache2 fpm}
     Installed versions:  0.9.8(07:39:01 02/12/22)(apache2 -fpm)
     Homepage:            https://gitweb.gentoo.org/proj/eselect-php.git/
     Description:         PHP eselect module

[I] dev-lang/php
     Available versions:
     (7.4)  7.4.28-r1^t
     (8.0)  8.0.16-r1^t ~8.0.17-r1^t ~8.0.18^t
     (8.1)  ~8.1.3-r1^t ~8.1.4-r1^t ~8.1.5^t
       {acl apache2 apparmor argon2 bcmath berkdb bzip2 calendar cdb cgi cjk +cli coverage +ctype curl debug embed enchant exif ffi +fileinfo +filter firebird +flatfile fpm ftp gd gdbm gmp +iconv imap inifile intl iodbc ipv6 +jit +json kerberos ldap ldap-sasl libedit lmdb mhash mssql mysql mysqli nls oci8-instant-client odbc +opcache pcntl pdo +phar phpdbg +posix postgres qdbm readline selinux +session session-mm sharedmem +simplexml snmp soap sockets sodium spell sqlite ssl systemd sysvipc test threads tidy +tokenizer tokyocabinet truetype unicode webp +xml xmlreader xmlrpc xmlwriter xpm xslt zip zlib}
     Installed versions:  7.4.28-r1(7.4)^t(13:10:20 04/29/22)(acl apache2 bcmath bzip2 cgi cli ctype curl exif fileinfo filter flatfile ftp gd gdbm iconv intl ipv6 jit json mysql mysqli nls opcache pdo phar posix postgres readline session simplexml spell sqlite ssl tidy tokenizer truetype unicode xml xmlreader xmlwriter zip zlib -argon2 -berkdb -calendar -cdb -cjk -coverage -debug -embed -enchant -ffi -firebird -fpm -gmp -imap -inifile -iodbc -kerberos -ldap -ldap-sasl -libedit -lmdb -mhash -mssql -oci8-instant-client -odbc -pcntl -phpdbg -qdbm -selinux -session-mm -sharedmem -snmp -soap -sockets -sodium -systemd -sysvipc -test -threads -tokyocabinet -webp -xmlrpc -xpm -xslt) 8.0.16-r1(8.0)^t(22:42:49 04/27/22)(acl apache2 bcmath bzip2 cgi cli ctype curl exif fileinfo filter flatfile ftp gd gdbm iconv intl ipv6 jit mysql mysqli nls opcache pdo phar posix postgres readline session simplexml spell sqlite ssl tidy tokenizer truetype unicode xml xmlreader xmlwriter zip zlib -apparmor -argon2 -berkdb -calendar -cdb -cjk -coverage -debug -embed -enchant -ffi -firebird -fpm -gmp -imap -inifile -iodbc -kerberos -ldap -ldap-sasl -libedit -lmdb -mhash -mssql -oci8-instant-client -odbc -pcntl -phpdbg -qdbm -selinux -session-mm -sharedmem -snmp -soap -sockets -sodium -systemd -sysvipc -test -threads -tokyocabinet -webp -xpm -xslt)
     Homepage:            https://www.php.net/
     Description:         The PHP language runtime engine

[I] dev-php/reactphp-promise
     Available versions:  2.8.0
     Installed versions:  2.8.0(21:26:46 04/27/22)
     Homepage:            https://reactphp.org/promise/
     Description:         A lightweight implementation of CommonJS Promises/A for PHP

[I] virtual/httpd-php
     Available versions:
     (7.4)  7.4
     (8.0)  8.0
     (8.1)  ~8.1
     Installed versions:  8.0(8.0)(19:08:33 11/10/21)
     Description:         Virtual to provide PHP-enabled webservers

[I] www-apps/phpBB
     Available versions:  (3.3.7) (~)3.3.7
       {ftp gd mssql mysqli postgres sqlite vhosts zlib}
     Installed versions:  3.3.7(3.3.7)(23:46:32 04/16/22)(ftp gd mysqli postgres sqlite vhosts zlib -mssql)
     Homepage:            https://www.phpbb.com/
     Description:         An open-source PHP-based bulletin board package

Found 5 matches
# 
As shown above, my instance of PHP 8.0.16-r1(8.0) has EXIF activated. But, a query of USE flags does not reveal any text having the following terms:

Code: Select all

janus / # equery uses dev-lang/php | grep byte
janus / # equery uses dev-lang/php | grep mult
janus / # equery uses dev-lang/php | grep -i mbstring
janus / # equery uses dev-lang/php | grep -i string
janus / # EIX_LIMIT=0 eix string |grep -i mult
     Description:         A writer monad for multi-line string literals
janus / #


The Lychee Installation Manual at https://lycheeorg.github.io/docs/#server-requirements notes the requirement "Mbstring". Something came to my attention (I cannot remember how this came to my attention) that I do not Mbstring activated. A search of portage did not reveal anything to me about multibyte.

So, I who know nothing about multibtye support, assumed that if my PHP installation has "exif" enabled, then anything I run under PHP ought to be able to read EXIF information. A developer form the Lychee discussion group advised:
Basically, there are two options for EXIF processing in Lychee. One is built-in native support in PHP, the other is the external exiftool that you need to install. Lychee prefers the latter (because it works considerably better than the rudimentary PHP built-in) but in principle it's supposed to autodetect if you have exiftool and if not, it should fall back to native. Weird that that didn't happen in your case. You haven't manually set the `have_exiftool` config variable to `1` by any chance, have you?
Source: https://gitter.im/LycheeOrg/Lobby?at=62 ... 7f85610ced

It turns out that I did later alter the `have_exiftool` config variable to `1` to get exif support to work, but that was after I installed media-libs/exiftool.
That causes me to wonder: just what does it mean when when the "exif" flag is enabled in PHP? Equery tells me:

Code: Select all

janus / # equery uses dev-lang/php
...
 + + exif                : Add support for reading EXIF headers from JPEG and TIFF images
...
This topic is morphing from a cautionary tale to a discussion about the sufficiency of the "exif" flag in PHP and/or its associated blurb in equery results.
Top
grknight
Retired Dev
Retired Dev
Posts: 2563
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Tue May 17, 2022 12:59 pm

jlpoole wrote: As shown above, my instance of PHP 8.0.16-r1(8.0) has EXIF activated. But, a query of USE flags does not reveal any text having the following terms:

Code: Select all

janus / # equery uses dev-lang/php | grep byte
janus / # equery uses dev-lang/php | grep mult
janus / # equery uses dev-lang/php | grep -i mbstring
janus / # equery uses dev-lang/php | grep -i string
janus / # EIX_LIMIT=0 eix string |grep -i mult
     Description:         A writer monad for multi-line string literals
janus / #


FWIW, the unicode USE on dev-lang/php is what enables mbstring on Gentoo's PHP. The profiles often enable this by default.

The command php -m or, with version, php8.0 -m will show which extensions, both modular and built-in, are enabled.
Top
jlpoole
Guru
Guru
User avatar
Posts: 495
Joined: Tue Nov 01, 2005 5:07 am
Location: Salem, OR

  • Quote

Post by jlpoole » Tue May 17, 2022 3:39 pm

Thanks for the helpful tip, grknight.

I do not recall tinkering, i.e. changing use flags, with my PHP package since I became aware of the problem, my fix was to install the package media-libs/exiftool and to change the Lychee configuration to use a shell command. Otherwise, it looks like my PHP settings have unicode and exif activated:

Code: Select all

janus /var/www/salemdata.us/htdocs/photos # cd /
janus / # eix -I php |grep -oP '.{1,5}unicode.{1,5}'
type unicode webp
type unicode xml
type unicode xml
janus / # eix -I php |grep -oP '.{1,5}exif.{1,5}'
hant exif ffi
curl exif file
curl exif file
janus / # date
Tue May 17 08:14:17 PDT 2022
janus / #

Ahah, I now remember how I troubleshot this. Lychee has their logs exposed through their administrative interface on the left: "Show Logs"

Code: Select all

2022-05-14 22:16:48 -- notice  -- App\Metadata\Extractor::extract -- 177 -- Falling back to native adapter.
2022-05-14 22:16:48 -- error   -- App\Metadata\Extractor::extract -- 172 -- Given path () to the exiftool binary is invalid
I then carefully (see below) went through the server requirements that Lychee specifies and could not match up their "Mbstring" with any USE flag in Gentoo, so I concluded that I did not have multibyte support. Per grknight's posting above, I do have multibyte support since the USE flag unicode is active.

Here are my notes from that investigation:

Code: Select all

per: https://lycheeorg.github.io/docs/installation.html

Lychee requires:
Lychee 4.4.0 and later:

    PHP >= 8.0 with these PHP extensions:
    Y    BCMath
    Y    Ctype
    Y    Exif
    Y    Ffmpeg (optional — to generate video thumbnails)
    Y    Fileinfo
    Y    GD
    Y    Imagick (optional — to generate better thumbnails)
    ?    JSON
    ?    Mbstring
    ?    OpenSSL
    Y    PDO
    Y    Tokenizer
    Y    XML
    Y    ZIP

Questionable ones:
    JSON -
        I do have:
            [I] dev-php/json-schema
                 Available versions:  5.2.10^t 5.2.11^t {test}
                 Installed versions:  5.2.11^t(22:19:37 04/27/22)(-test)
                 Homepage:            https://github.com/justinrainbow/json-schema
                 Description:         PHP implementation of JSON schema

            [I] dev-php/jsonlint
                 Available versions:  ~1.8.2^t 1.8.3-r1 {test}
                 Installed versions:  1.8.3-r1(21:24:29 04/27/22)
                 Homepage:            https://github.com/Seldaek/jsonlint
                 Description:         JSON Lint for PHP


    Mbstring - multibyte string??
        Multibyte String    https://www.php.net/manual/en/book.mbstring.php
        
    OpenSSL - I do have SSL
    
janus /usr/local/src/Lychee/app/Image # equery uses dev-lang/php
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for dev-lang/php-8.0.16-r1:
 U I
 + + acl                 : Add support for Access Control Lists
 + + apache2             : Add Apache2 support
 - - apparmor            : Support FPM application confinement through sys-libs/libapparmor
 - - argon2              : Enable password hashing algorithm from app-crypt/argon2
 + + bcmath              : Add support for libbcmath
 - - berkdb              : Add support for sys-libs/db (Berkeley DB for MySQL)
 + + bzip2               : Use the bzlib compression library
 - - calendar            : Add support for calendars (not using mcal!)
 - - cdb                 : Add support for the CDB database engine from the author of qmail
 + + cgi                 : Add CGI script support
 - - cjk                 : Add support for Multi-byte character languages (Chinese, Japanese, Korean)
 + + cli                 : Enable CLI SAPI
 + + ctype               : Enable ctype functions
 + + curl                : Add support for client-side URL transfer library
 - - debug               : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
                           https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
 - - embed               : Enable embed SAPI
 - - enchant             : Add supports Enchant spelling library.
 + + exif                : Add support for reading EXIF headers from JPEG and TIFF images
 - - ffi                 : Add foreign function interface (ffi extension) support
 + + fileinfo            : Add fileinfo extension support
 + + filter              : Add filter extension support
 + + flatfile            : Add dbm support for flat files
 - - fpm                 : Enable the FastCGI Process Manager SAPI
 + + ftp                 : Add FTP (File Transfer Protocol) support
 + + gd                  : Adds support for gd (bundled with PHP)
 + + gdbm                : Add support for sys-libs/gdbm (GNU database libraries)
 - - gmp                 : Add support for dev-libs/gmp (GNU MP library)
 + + iconv               : Enable support for the iconv character set conversion library
 - - imap                : Add support for IMAP (Internet Mail Application Protocol)
 - - inifile             : Add dbm support for .ini files
 + + intl                : Enables the intl extension for extended internalization support
 - - iodbc               : Add support for iODBC library
 + + ipv6                : Add support for IP version 6
 + + jit                 : Enable PCRE JIT support
 - - kerberos            : Add kerberos support
 - - ldap                : Add LDAP support (Lightweight Directory Access Protocol)
 - - ldap-sasl           : Add SASL support for the PHP LDAP extension
 - - libedit             : Use the libedit library (replacement for readline)
 - - lmdb                : Enable support for dev-db/lmdb db backend
 - - mhash               : Add support for the mhash library
 - - mssql               : Add support for Microsoft SQL Server database
 + + mysql               : Add mySQL Database support
 + + mysqli              : Add support for the improved mySQL libraries
 + + nls                 : Add Native Language Support (using gettext - GNU locale utilities)
 - - oci8-instant-client : Use dev-db/oracle-instantclient-basic as Oracle provider instead of requiring a full Oracle server install
 - - odbc                : Add ODBC Support (Open DataBase Connectivity)
 + + opcache             : Enables built-in opcode cache, replacing pecl-apc et al.
 - - pcntl               : Add support for process creation functions
 + + pdo                 : Enable the bundled PDO extensions
 + + phar                : Enables the phar extension to provide phar archive support
 - - phpdbg              : Enable the PHP Debug Command Line SAPI (like gdb for php)
 + + posix               : Add support for POSIX-compatible functions
 + + postgres            : Add support for the postgresql database
 - - qdbm                : Add support for the qdbm (Quick Database Manager) library
 + + readline            : Enable support for libreadline, a GNU line-editing library that almost everyone wants
 + + session             : Add persistent session support
 - - session-mm          : Include dev-libs/mm support for session storage
 - - sharedmem           : Add support for shared memory use
 + + simplexml           : Support for SimpleXML
 - - snmp                : Add support for the Simple Network Management Protocol if available
 - - soap                : Add support for SOAP (Simple Object Access Protocol)
 - - sockets             : Add support for tcp/ip sockets
 - - sodium              : Enable support for crypto through dev-libs/libsodium
 + + spell               : Add dictionary support
 + + sqlite              : Add support for sqlite - embedded sql database
 + + ssl                 : Add support for SSL/TLS connections (Secure Socket Layer / Transport Layer Security)
 - - systemd             : Enable use of systemd-specific libraries and features like socket activation or session tracking
 - - sysvipc             : Support for System V-compatible inter-process communication
 - - test                : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled
                           independently)
 - - threads             : Add threads support for various packages. Usually pthreads
 + + tidy                : Add support for HTML Tidy
 + + tokenizer           : Add support for the PHP file parser
 - - tokyocabinet        : Enable support for dev-db/tokyocabinet db backend
 + + truetype            : Add support for FreeType and/or FreeType2 fonts
 + + unicode             : Add support for Unicode
 - - webp                : Enable webp support for GD in php-7.x
 + + xml                 : Add support for XML files
 + + xmlreader           : Enable XMLReader support
 + + xmlwriter           : Enable XMLWriter support
 - - xpm                 : Add support for XPM graphics format
 - - xslt                : Enable the XSL extension
 + + zip                 : Enable support for ZIP archives
 + + zlib                : Add support for zlib (de)compression
janus /usr/local/src/Lychee/app/Image # 
So, now the state of matters is 1) Gentoo's PHP has Multibyte support activated through the USE flag unicode, 2) I have EXIF support enable in PHP, and 3) Lychee's native PHP support failed. Looks like something between the Gentoo's unicode support vs. Lychee's harnessing exif. But, I have a works-for-me solution: use the acknowledged superior command line tool. This discussion may help others who wish to pursue this matter further.

Thank you, again, for those who participated in this topic.
Top
Hu
Administrator
Administrator
Posts: 24391
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Tue May 17, 2022 4:03 pm

Given the non-obvious initial failure, this seems like an ideal case for an ebuild, at least a live ebuild if not a proper release ebuild, to memorize all these quirks so Portage can handle them automatically. That would also preclude accidentally uninstalling exiftool via --depclean, because the ebuild would inform Portage that it is necessary for Lychee.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic