PHP Agent lets you manage files on a web server via HTTP — without any SSH account or SSH daemon. The entire server-side logic lives in one file: sftp.php.
Typical use case: shared hosting where you have FTP/SFTP disabled or no shell access, but PHP is available.
sftp.php included in the plugin package has no password configured.
If you upload it to your server before setting a password in the plugin, the server will reject every connection with HTTP 503.
Always set the password in the plugin dialog first, save the session, then upload.
sftp.php. The password itself is never written to any file.sftp.php to your web server.sftp.php. The password itself never leaves your computer. The server checks the signature, the time and a single-use nonce, and refuses any request whose operation, parameters or content were altered on the way.This means: your password is in no file and on no network. The hash in sftp.php, however, is the key the server checks signatures with — whoever can read that file can send signed requests. Keep it readable by the web server only (permissions 600 or 640), and use a long random password: the hash is a single salted SHA-256, so a short or common password can be guessed from it offline.
http:// anyone on the network path sees every file and listing you transfer. HTTPS encrypts them.
Open the plugin connection dialog (Net → Connect, or the Network Neighborhood panel). Fill in:
| Field | What to enter | Example |
|---|---|---|
| Connect to: | Full HTTPS URL to sftp.php on your server (the file does not exist yet — enter where it will be) | https://example.com/sftp.php |
| Transfer mode: | Select PHP Agent (HTTP) from the dropdown | — |
| Password: | Choose any password — this will be your shared secret between TC and the server | MySecretPass123 |
| Session name: | Give the session a name for easy identification | My Hosting |
https:// in production. Plain http:// is for local testing only — over HTTP the files and listings you transfer travel unencrypted.
Click Save (or press F2 if available). At this point the plugin:
sftpplug.inisftp.php and writes two fields into it: AGENT_PSK_SALT (random) and AGENT_PSK_SHA256 (SHA-256 hash of salt + your password)The local sftp.php that now contains your password hash is located at:
...\Total Commander\plugins\wfx\SFTPplug\sftp.php
This is the file you will upload. Do not use the original sftp.php from the download package — it has empty PSK fields.
Copy the file from the path above to your web server so that it is accessible at the URL you entered in Step 1.
Example: if you entered https://example.com/sftp.php, upload the file to the root of your web space as sftp.php.
You can upload it using any method: FTP, cPanel File Manager, your hosting control panel, or any other file manager.
sftp.php to mode 644 (readable by web server, not world-writable).
Before connecting, verify the script is reachable and correctly configured. Open this URL in your browser:
https://example.com/sftp.php?op=PROBE
Expected responses:
| Response | Meaning |
|---|---|
HTTP 200 with JSON containing "ok":true | All good — proceed to connect |
| HTTP 401 Unauthorized | Script is running but waiting for auth — this is also OK (plugin will authenticate) |
| HTTP 503 Service Unavailable | PSK not configured — you uploaded the wrong file (without hash). Repeat from Step 2. |
| HTTP 404 Not Found | Wrong URL or file not uploaded yet |
| PHP error page | PHP version too old (<7.4) or required extension disabled on server |
Select your saved session in Total Commander and connect. The plugin probes the endpoint, confirms capabilities, and opens the remote file panel.
| Location | What is stored | Is the password exposed? |
|---|---|---|
sftpplug.ini (on your PC) | Password encrypted with Windows DPAPI (user-account bound) | No — DPAPI ciphertext only |
sftp.php (on server) | AGENT_PSK_SALT (random) + AGENT_PSK_SHA256 = SHA-256(salt + password) | No — one-way hash only. The hash is the signing key, though: protect the file like a password |
| Network traffic | A signature per request (HMAC-SHA256, single-use nonce, 5-minute window) — never the password | No. Over plain HTTP the transferred files and listings themselves are readable |
sftp.php signs requests, so keep that file private to the web server. HTTPS keeps the transferred files private as well, and is required for anything beyond local testing.
https://example.com/sftp.php https://example.com/tools/sftp.php https://example.com:8443/sftp.php http://192.168.1.10/sftp.php (local testing only — no encryption)
When the TAR stream checkbox is enabled in the connection dialog, all directory downloads and batch file transfers are handled as a single TAR archive exchange instead of individual HTTP requests. This eliminates per-request overhead and is critical on shared hosting (OVH, home.pl) where thousands of individual GET/PUT requests would be extremely slow.
When you copy multiple remote files or a remote directory to local, the plugin collects all file paths during the TC copy operation and sends a single POST ?op=TAR_PACK request with all paths listed in the body (one per line). The server-side sftp.php streams a ustar TAR archive of exactly those files directly to the response — without any temporary file or memory buffer. The plugin parses the TAR on the fly, creates local directories and files as each entry arrives, and shows a progress bar based on file count. GNU long-name entries (././@LongLink) are fully supported for paths over 99 characters.
When you copy an entire remote directory to local, the plugin sends one GET ?op=TAR_STREAM&path=... request. The server streams a ustar TAR of the entire directory tree. The plugin parses and extracts on the fly.
When you copy multiple local files or directories to a remote location, the plugin batches all of them into a single ustar TAR stream and sends one POST ?op=TAR_EXTRACT&path=... request. The server extracts the archive. Batching is transparent to Total Commander — files are queued during the copy operation and sent all at once when TC signals end-of-batch. The total archive size is sent as a proper 64-bit Content-Length header, so uploads of directories exceeding 4 GB work correctly.
sftp.php on the server (one that supports TAR_STREAM, TAR_EXTRACT, and TAR_PACK). Always upload the sftp.php from the plugin directory — not an older copy. Resume is not supported for TAR transfers; if interrupted, re-copy the whole set.
When PHP Agent or PHP Shell mode is active, the connection dialog shows two extra controls (replacing the encoding codepage and system dropdowns):
recommended_chunk_size from the server's PROBE response, clamped to 1–64 MiB. Falls back to 1 MiB if the server does not advertise a recommendation.shell_exec enabled)If shell_exec is available on your server, you can use PHP Shell (HTTP) transfer mode for a pseudo-terminal experience:
Uses the same sftp.php file — no separate deployment needed.
sftp.php lives in (AGENT_ROOT), but shell commands run as the web server user and reach everything that user can. Anyone holding the password gets that access. If you do not need the shell, open sftp.php and set const AGENT_ALLOW_SHELL = false; — the agent then refuses SHELL_EXEC and the password gives file access only.
fopen, opendir, etc.) — must not be in disable_functionshash and json extensions (enabled by default on most hosts)shell_exec or proc_open not disabledupload_max_filesize — maximum size per chunkpost_max_size — must be larger than upload_max_filesizemax_execution_time — increase for large files on slow serversmemory_limit — 128 MB or more recommendedThe plugin reads these limits via PROBE and adjusts chunk size automatically.
| Error | Cause | Fix |
|---|---|---|
| HTTP 503 | Uploaded the raw sftp.php without PSK configured | Save session in plugin first, then re-upload the modified sftp.php from the plugin directory |
| HTTP 401 | Password in plugin does not match hash in sftp.php | Re-save the session with the correct password, re-upload sftp.php |
| HTTP 404 | sftp.php not at the URL you entered | Verify the URL and that the file was uploaded to the correct path |
| HTTP 500 | PHP error on server | Check server PHP error log; verify PHP version ≥ 7.4 and required functions not disabled |
| Connection refused / timeout | Server unreachable or HTTPS certificate error | Test URL in browser; check SSL certificate validity |
| TAR batch download — 0 files received | Old sftp.php without TAR_PACK support, or path mismatch | Upload the current sftp.php from the plugin directory to the server |
| HTTP 504 on TAR download (OVH/home.pl) | Old sftp.php that buffers TAR in php://temp before sending | Upload the current sftp.php — streaming version eliminates the timeout |
| TAR upload fails for large directories (>4 GB) | Old plugin build — 32-bit integer overflow in Content-Length | Update the plugin to the current build |