NoiseByNorthwest / php-spx

A simple & straight-to-the-point PHP profiling extension with its built-in web UI
GNU General Public License v3.0
2.12k stars 83 forks source link

Laravel+Nginx+Fpm no Web UI #154

Open yaroslavmo opened 3 years ago

yaroslavmo commented 3 years ago

Hi. I am trying to get SPX working in Laravel.

The CLI is working fine but I could not get to the Web UI.

Here is Nginx config:

server {

  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;
  root /opt/dreamfactory/public;
  index index.php index.html index.htm;
  gzip on;
  gzip_disable "msie6";
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {

    root /usr/share/nginx/html;
  }
  location ~ \.php$ {

    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

When I open http://<my application host>/, it redirects me to the login page http://<my application host>/dreamfactory/dist/index.html#/login. When I try http://<my application host>/?SPX_KEY=dev&SPX_UI_URI=/ according to the doc it still just redirects me to the login page. At this point, I have never seen the Web UI of SPX on my site. Can you help me get it working?

ilnytskyi commented 3 years ago

Have you tried this (info from docs) ?

But, on most PHP-FPM setups, you will have a permission issue preventing SPX to open a file under /proc/self directory. This is due to the fact that PHP-FPM master process runs as root when child processes run as another unprivileged user.

When this is the case, the process.dumpable = yes line must be added to the FPM pool configuration so that child processes will be able to read any file under /proc/self.
yaroslavmo commented 3 years ago

Yes I tried to set dumpable it did not help

NoiseByNorthwest commented 3 years ago

The authentication fails so your script is executed instead of SPX's UI. You should have some logs explaining why the access is not granted.

The 2 main possible issues are:

What are your SPX INI settings ? Do you use docker ?

kandy commented 3 years ago

Can be related to https://github.com/NoiseByNorthwest/php-spx/issues/114#issuecomment-600426937

viktorprogger commented 2 years ago

del

talbergs commented 1 year ago

You will fix your issue by spx.http_trusted_proxies="*"