# CLI: input password without showing it

- Thread: https://externals.io/message/54161
- Original archive: https://news-web.php.net/php.internals/54161
- Started by Reindl Harald on 2011-07-23T19:07:58+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #54161 — Reindl Harald — 2011-07-23T19:07:58+00:00

URL: https://externals.io/message/54161#54161

hi

is there any way to request a password from a user without
showing the input in the terminal?

$input_pwd = trim(fgets(STDIN));

works nice as long no foreigner is in the room :-(

---

## #54162 — Rasmus Lerdorf — 2011-07-23T19:16:36+00:00

URL: https://externals.io/message/54161#54162 · In reply to: #54161

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> hi
> 
> is there any way to request a password from a user without showing
> the input in the terminal?
> 
> $input_pwd = trim(fgets(STDIN));
> 
> works nice as long no foreigner is in the room :-(

Really not an internals question. This is more a StackOverflow type of
question, where in fact this has been asked and answered a couple of times:

http://stackoverflow.com/questions/187736/command-line-password-prompt-in-php

- -Rasmus
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk4rHhQACgkQlxayKTuqOuDJTgCfc8gHHXqc2hioxYqA5aOGmhpk
OeAAnArlpmj+jbeyAmxbsHtxRIwNwN+o
=nU1k
-----END PGP SIGNATURE

---

## #54163 — Kiall Mac Innes — 2011-07-23T19:17:16+00:00

URL: https://externals.io/message/54161#54163 · In reply to: #54161

Check the password method here:

https://github.com/kohana-minion/core/blob/develop/classes/minion/cli.php

It should do what you want on windows+linux..

Kiall

On Sat, Jul 23, 2011 at 8:07 PM, Reindl Harald <h.reindl@thelounge.net>wrote:

> hi
>
> is there any way to request a password from a user without
> showing the input in the terminal?
>
> $input_pwd = trim(fgets(STDIN));
>
> works nice as long no foreigner is in the room :-(
