[sane-devel] Sane web GUI issue

Olaf Meeuwissen paddy-hack at member.fsf.org
Sun Jun 2 03:49:41 BST 2019


Hi Mark,

Mark DM writes:

> I am converting an existing web GUI to include SANE compatibility . I am
> working on getting things like scanner info , etc .
>
> When the web GUI executes a
>
> shell_exec(scanimage -T -d scannername)
>
> from PHP , I get nothing on the web GUI . I can echo the command and paste
> into terminal and it works. I can also use

Define "works".

For concreteness' sake, here what I get using the test backend

  $ scanimage -T -d test:0
  scanimage: scanning image of size 157x196 pixels at 8 bits/pixel
  scanimage: acquiring gray frame, 8 bits/sample
  scanimage: reading one scanline, 157 bytes...	PASS
  scanimage: reading one byte...		PASS
  scanimage: stepped read, 2 bytes... 	PASS
  scanimage: stepped read, 4 bytes... 	PASS
  scanimage: stepped read, 8 bytes... 	PASS
  scanimage: stepped read, 16 bytes... 	PASS
  scanimage: stepped read, 32 bytes... 	PASS
  scanimage: stepped read, 64 bytes... 	PASS
  scanimage: stepped read, 128 bytes... 	PASS
  scanimage: stepped read, 256 bytes... 	PASS
  scanimage: stepped read, 255 bytes... 	PASS
  scanimage: stepped read, 127 bytes... 	PASS
  scanimage: stepped read, 63 bytes... 	PASS
  scanimage: stepped read, 31 bytes... 	PASS
  scanimage: stepped read, 15 bytes... 	PASS
  scanimage: stepped read, 7 bytes... 	PASS
  scanimage: stepped read, 3 bytes... 	PASS
  $ scanimage -T -d test:0 2>/dev/null

I think your shell_exec() ignores whatever ends up on stderr.

> shell_exec(scanimage -L)

  $ scanimage -L 2>/dev/null
  device `test:0' is a Noname frontend-tester virtual device
  device `test:1' is a Noname frontend-tester virtual device
  device `pnm:0' is a Noname PNM file reader virtual device
  device `pnm:1' is a Noname PNM file reader virtual device

> and
> shell_exec(scanimage -V)

  $ scanimage -V 2>/dev/null
  scanimage (sane-backends) 1.0.25; backend version 1.0.25

So both -L and -V report back on stdout.

> successfully, as well as initiate a scan
>
> I am using the test backend and maybe this has something to do with it?
>
> I have added www-data (debian web user) to the groups saned, scanner and
> adm and still no luck with the one command from web server

Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join



More information about the sane-devel mailing list