h5ai
h5ai copied to clipboard
An Empty Page Was Shown With PHP 8.1
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
- Ubuntu 22.04.1 LTS x86_64
- Nginx 1.22.0 built with OpenSSL 3.0.2
- 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";
}
}