Open HandyGadget opened 2 years ago
Hello @HandyGadget , Thanks for sharing the issue with us.
As i have checked in PHP 8.0 and WP 5.8, in Nginx Helper settings page, there is a blue button showing "Save All Changes". Please check the plugin's settings page again.
Can you please share more details? i.e. screenshot or video or related error_log so that the issue can be identified.
I actually encountered this issue recently using php 8.1. Also tested on php 7.4 and this doesn't happen.
On further investigation, I noticed the issue could be fixed by setting the "$recursive" parameter to true to ensure all directories are created in the path.
Code path location: /nginx-helper/admin/partials/nginx-helper-general-options.php
Code line causing issue (line: 630)
if ( ! is_dir( $log_path ) ) { mkdir( $log_path ); // error happens here }
Code with proposed fix (line: 630)
if ( ! is_dir( $log_path ) ) { mkdir( $log_path,0777,true ); // setting $recursive to true fixes the issue }
@HandyGadget :
Upon analyzing the code, this issue may happen if the directories are non-existent and the code preceding /nginx-helper/admin/partials/nginx-helper-general-options.php#630
throws a fatal error OR submit_button()
fails for some reason.
@asule-star: If ( ! is_dir( $log_path ) ) { mkdir( $log_path );
fails to create the directory, it will throw a warning instead of a fatal error, i.e., the code execution will not stop. Even if it does, something like this will happen:
# Warning if #630 fails to create the directory:
Warning: mkdir(): No such file or directory in /app/wordpress/wp-content/plugins/nginx-helper/admin/partials/nginx-helper-general-options.php on line 630
Can't write on log file.
Check you have write permission on /app/wordpress/wp-content/uploads/nginx-helper/nginx.log
Server architecture: Linux 5.15.0-58-generic x86_64
Web server: nginx/1.17.10
PHP version: 8.1.14 (Supports 64bit values) (also on: PHP 7.4, 8.0)
PHP SAPI: fpm-fcgi
Version: 6.1.1
With only two plugins installed and activated there is no blue button to save changes.
[Operating System] Description: Ubuntu 20.04.4 LTS
[NGINX] Branch: mainline Version: 1.20.2
[PHP] Info: PHP 8.0.16 (cli) (built: Feb 21 2022 14:42:00) ( NTS )