Commands in pfSsh.php don't work (manual php scripts do)
-
Trying to automate some things. Looking at the PHP developer shell:
https://pfsense-docs.readthedocs.io/en/latest/development/using-the-php-pfsense-shell.html
If I log in as any user and, from the menu, either run
12
or run8
and then executepfSsh.php
, I can't get anything to run except thehelp
command.In other words, while I can run the
help
command, I can't run anythinghelp
suggests and get any results.Example:
Starting the pfSense developer shell.... Welcome to the pfSense developer shell Type "help" to show common usage scenarios. Available playback commands: changepassword disablecarp disablecarpmaint disabledhcpd disablereferercheck enableallowallwan enablecarp enablecarpmaint enablesshd externalconfiglocator gatewaystatus generateguicert gitsync installpkg listpkg pfanchordrill pftabledrill removepkgconfig removeshaper resetwebgui restartdhcpd restartipsec svc uninstallpkg pfSense shell: help Enter a series of commands and then execute the set with "exec". For example: echo "foo"; // php command echo "foo2"; // php command ! echo "heh" # shell command exec Example commands: record <recordingfilename> stoprecording showrecordings parse_config(true); # reloads the $config array $temp = print_r($config, true); more($temp); /* to output a configuration array */ print_r($config); (snip) pfSense shell: parse_config(true); pfSense shell: print_r($config); pfSense shell:
The output is nothing.
However, if I do it manually through the php interactive shell, it seems to work:
php -a -d display_errors=true require_once("globals.inc"); require_once("functions.inc"); require_once("config.inc"); require_once("util.inc"); parse_config(true); print_r($config);
(The config tree prints).
Am I wrong to expect the php developer shell
pfSsh.php
to work the same asphp -a
?I'm fine with writing my own php if that's the preferred method, but I was thinking it would be better to run it through the provided shell script. Am I maybe overlooking something about how to do that?
Thanks very much.