-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebUI with php -S #201
Comments
Hi @cycle20, yes, it possible. You need proper command. First - you need to have a simple <?php
phpinfo(); Next - use this command to run web-ui for specified directory php -d spx.data_dir="./my-folder-with-spx-profiles/" -S localhost:8000 -t "full-path-to-folder-with-index-php/" I'm personally using bash script to open saved profiles: #!/usr/bin/env bash
help=$(cat << EOF
----------------------------------------------------------------
$(basename "$0") <path>
path: Path to folder with PHP-SPX profiles
EOF
)
if [ -d "$1" ]; then
data_dir=$1
else
data_dir=$(dirname "$1")
fi
## Main
if [ $# -eq 0 ]; then
>&2 echo "$(basename "$0"): Missing required argument."
>&2 echo "$help"
exit 1
fi
>&2 echo "-- Profiler Web-UI URI: http://localhost:8000/?SPX_KEY=dev&SPX_UI_URI=/"
php -d spx.data_dir="$data_dir" -S localhost:8000 -t "$(phpenv prefix)/www" Usage - is simple as possible: ./spx-profiler-ui.sh ./my-folder-with-saved-profiles/ |
i have also issues getting this started properly:
and started via
i get a 404 :( |
@verfriemelt-dot-org As @AlexNDRmac explained you need an URL targeting a real PHP script (even an empty script is fine for this purpose) within your |
i did that 🤔
|
But you ultimately get a 404 so something must be wrong with your setup or the URL you use. |
i am requesting this: http://localhost:8000/?SPX_KEY=dev&SPX_UI_URI=/ so pretty much the same setup as @cycle20 and i cannot find what i am missing :( |
@verfriemelt-dot-org maybe smth with web-ui assets path. Double check if you have web-ui assets in Also, I would recommend to use fully qualified path for directory with |
Hi @AlexNDRmac, NOTE: I tried |
Ok :) Let's try with the clear state. Suppose - we does't have SPX - just default PHP in your OS. What needs to be done:
Now we have:
Ok - let's try to check if extension works: cd ~/src/php-spx
## This command will print extension info.
php -d extension=./modules/spx.so --ri SPX
## output
SPX
SPX Support => enabled
SPX Version => 0.4.12
..... Let's try to open web-ui (without configuration and installed extension): cd ~/src/php-spx
## Create dir for profiles
mkdir ~/src/php-spx/profiles
## Create required index.php file
echo '<?php' > ~/src/php-spx/profiles/index.php
## Start web-ui
php -d extension=./modules/spx.so \
-d spx.key=dev \
-d spx.http_ui_assets_dir=~/src/php-spx/assets/web-ui \
-d spx.data_dir=~/src/php-spx/profiles \
-S localhost:8000 \
-t ~/src/php-spx/profiles
## Open web-ui in default browser
open http://localhost:8000/?SPX_KEY=dev&SPX_UI_URI=/ If you already have profiles - just put it to specified Profit. |
It may be a broken SPX 404 response. In this case it is caused by a unfound UI asset file, is |
ah geeez, i had a typo in my php.ini :( sorry for wasting your time! |
Hi @AlexNDRmac , php -d extension=./modules/spx.so \
-d spx.key=dev \
-d spx.http_ui_assets_dir=/tmp/php-spx/assets/web-ui \
-d spx.data_dir=/tmp/php-spx/profiles \
-S localhost:8000 \
-t /tmp/php-spx/profiles
Server log:
This request loads only the blank index.php, it does not result the web ui. :( Thank you, |
Try to add phpinfo() to index.php and see what's in SPX ini directives. Maybe spx.key is missing or different, maybe you have smth in whitelist. If so - try to redefine this param with cli command. |
Do you mean spx.http_key or spx.key? |
Ok, it works. I also had to add to the command line-defined list of derectives: spx.http_key, spx.http_enabled, spx.http_ip_whitelist. |
Final summary: php -d extension=./modules/spx.so \
-d spx.key=dev \
-d spx.http_key=dev \
-d spx.http_ip_whitelist=127.0.0.1 \
-d spx.http_enabled=1 \
-d spx.http_ui_assets_dir=/tmp/php-spx/assets/web-ui \
-d spx.data_dir=/tmp/php-spx/profiles \
-S localhost:8000 \
-t /tmp/php-spx/profiles |
Hi,
Is it possible to serve the web-ui by
php -S localhost:8000
?I would like to view reported data generated by command line script execution.
My config is:
I get HTTP status 404 for this request: http://localhost:8000/?SPX_KEY=dev&SPX_UI_URI=/
Thanks in advance,
Csongor
The text was updated successfully, but these errors were encountered: