BookStack: Unable to run bookstack with php 7.4
Hey, I just spent a lot of time to find out that bookstack does not work on my archlinux with php 7.4.
My nginx config:
server {
root /usr/share/webapps/bookstack/public;
listen 80;
server_name localhost;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
# default fastcgi_params
include fastcgi_params;
# fastcgi settings
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
# fastcgi params
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
}
Both the php-fpm and php73-fpm services are running fine. When I switch to php 7.3, the page loads and everything works. The only thing I do is change fastcgi_pass unix:/run/php-fpm/php-fpm.sock; to fastcgi_pass unix:/run/php73-fpm/php-fpm.sock; in the nginx config above.
When trying to run bookstack on php 7.4, I get a blank page on http://localhost an following errors in my nginx log:
Mär 19 12:52:02 amaury-pc nginx[5191]: 2020/03/19 12:52:02 [error] 5191#5191: *14 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/usr/share/webapps/bookstack/storage/framework/views/91645b6b6196080a0a63b4cbf9174ea58199722f.php): failed to open stream: Read-only file system in /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:133
Mär 19 12:52:02 amaury-pc nginx[5191]: Stack trace:
Mär 19 12:52:02 amaury-pc nginx[5191]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
Mär 19 12:52:02 amaury-pc nginx[5191]: #1 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(133): file_put_contents()
Mär 19 12:52:02 amaury-pc nginx[5191]: #2 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(129): Illuminate\Filesystem\Filesystem->put()
Mär 19 12:52:02 amaury-pc nginx[5191]: #3 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile()
Mär 19 12:52:02 amaury-pc nginx[5191]: #4 /usr/share/webapps/bookstack/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(36): Illuminate\View\Engines\CompilerEngine->get()
Mär 19 12:52:02 amaury-pc nginx[5191]: #5 /usr/shar...PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/usr/share/webapps/bookstack/storage/framework/views/91645b6b6196080a0a63b4cbf9174ea58199722f.php): failed to open stream: Read-only file system in /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:133
Mär 19 12:52:02 amaury-pc nginx[5191]: Stack trace:
Mär 19 12:52:02 amaury-pc nginx[5191]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
Mär 19 12:52:02 amaury-pc nginx[5191]: #1 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(133): file_put_contents()
Mär 19 12:52:02 amaury-pc nginx[5191]: #2 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(129): Illuminate\Filesystem\Filesystem->put()
Mär 19 12:52:02 amaury-pc nginx[5191]: #3 /usr/share/webapps/bookstack/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile()
Mär 19 12:52:02 amaury-pc nginx[5191]: #4 /usr/share/webapps/bookstack/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(36): Illuminate
I have been wondering why it is looking for an inexistent file in the views folder, until I noticed that switching to php 7.3 solves the issue. The whole bookstack folder is recursively owned and writable by the http user.
- Exact BookStack Version (Found in settings): 0.28.3
- PHP Version: 7.4.3
- Hosting Method (Nginx/Apache/Docker): nginx with php 7.4
I did a few diffs to see if it could be a configuration issue:
diff /etc/php/php.ini /etc/php73/php.ini
759c759
< extension_dir = "/usr/lib/php/modules/"
---
> extension_dir = "/usr/lib/php73/modules/"
diff /etc/php/php-fpm.conf /etc/php73/php-fpm.conf
17c17
< ;pid = /run/php-fpm/php-fpm.pid
---
> ;pid = /run/php73-fpm/php-fpm.pid
143c143
< include=/etc/php/php-fpm.d/*.conf
---
> include=/etc/php73/php-fpm.d/*.conf
The following are the only files in the php(73)-fpm.d/ folder
diff /etc/php/php-fpm.d/www.conf /etc/php73/php-fpm.d/www.conf
36c36
< listen = /run/php-fpm/php-fpm.sock
---
> listen = /run/php73-fpm/php-fpm.sock
117c117
< ; Default Value: (min_spare_servers + max_spare_servers) / 2
---
> ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
232c232
< ; It's available in: /usr/share/php/fpm/status.html
---
> ; It's available in: /usr/share/php73/fpm/status.html
Any help is greatly appreciated. I am currently trying to submit bookstack to the Arch User Repositories and make it easy to install, run and update it in archlinux and derivatives.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (8 by maintainers)
Will do - let me do a reproduction test first on this - if that fails then at least I have an also-broken environment for debugging this!
I’ll try and get an archlinux VM up and running tomorrow and do some deeper investigation. I can confirm that PHP7.4 FPM on Ubuntu 18.04/20.04 and Debian Buster both work!