h5ai icon indicating copy to clipboard operation
h5ai copied to clipboard

An Empty Page Was Shown With PHP 8.1

Open fang-d opened this issue 2 years ago • 0 comments

My Problem

When I was trying to visit my h5ai website, an empty page was shown. To find out what the problem was, I tried to add PHP command ini_set('display_errors',1); in the front of _h5ai/public/index.php and I got the following error message:

Warning: Undefined array key "SERVER_SOFTWARE" in /usr/share/nginx/share/_h5ai/private/php/core/class-setup.php on line 56

I wonder if h5ai is compatible with php8. If it is compatible, what is wrong with my configuration?

My Environment

  1. Ubuntu 22.04.1 LTS x86_64
  2. Nginx 1.22.0 built with OpenSSL 3.0.2
  3. PHP/PHP-FPM 8.1.2

Website Folder

/usr/share/nginx/share
└── _h5ai
    ├── private
    │   ├── cache
    │   ├── conf
    │   │   └── l10n
    │   └── php
    │       ├── core
    │       ├── ext
    │       └── pages
    └── public
        ├── cache
        ├── css
        ├── ext
        ├── images
        │   ├── fallback
        │   ├── favicon
        │   ├── themes
        │   │   ├── comity
        │   │   └── default
        │   └── ui
        └── js

Nginx Configuration

upstream php-fpm {
    server unix:/run/php/php8.1-fpm.sock;
}

server {
    server_name ******;
    listen 80;
    listen [::]:80;
    return 301 https://$server_name$request_uri;
}

server {
    server_name ******;
    listen 443      ssl http2;
    listen [::]:443 ssl http2;

    root "/usr/share/nginx/share";
    index index.html index.htm index.php "/_h5ai/public/index.php";

    include "snippets/ssl.conf";
    include "snippets/gzip.conf";

    location ~ \.php$ {
        fastcgi_pass   php-fpm;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        "params/fastcgi";
    }
}

fang-d avatar Aug 19 '22 22:08 fang-d