iignatios
If the wordops installed PHP8.0 on your server but sites not updated to PHP8.0, you can manually update the sites to use PHP8.0. For this, I use WinSCP for editing files, not use the SSH. The putty (ssh) is used for restart, reload nginx, PHP, etc. I'm not an expert in this subject, all these are learned from Googling. If there is any mistake please correct me.
First, verify your server updated to PHP8.0 by navigating to the following directory.
/etc/php/8.0/
check php8.0 process running on your server running following command line.
sudo service php8.0-fpm status
The response should be,
● php8.1-fpm.service - The PHP 8.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.0-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-01-29 13:16:47 +0530; 6h ago
Docs: man:php-fpm8.0(8)
Process: 12356 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.0/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS)
Main PID: 12355 (php-fpm8.0)
Status: "Processes active: 0, idle: 0, Requests: 4200, slow: 0, Traffic: 0req/sec"
Tasks: 1 (limit: 2321)
Memory: 339.4M
CGroup: /system.slice/php8.0-fpm.service
└─12355 php-fpm: master process (/etc/php/8.0/fpm/php-fpm.conf)
Navigate to the "/etc/nginx/" directory open the file, "upstream.conf" file, and check it has the following lines. If it doesn't have add it.
#-------------------------------
# PHP 8.0
#-------------------------------
# PHP 8.0 upstream with load-balancing on two unix sockets
upstream php80 {
least_conn;
server unix:/var/run/php/php80-fpm.sock;
server unix:/var/run/php/php80-two-fpm.sock;
keepalive 5;
}
# PHP 8.0 debug
upstream debug80 {
# Debug Pool
server 127.0.0.1:9175;
}
Then go to the "/etc/php/8.1/fpm/pool.d/" directory and check it has the following files,
debug.conf
www.conf
www-two.conf
Then navigate to "/etc/nginx/common/" directory and check whether it has "wpfc-php81.conf" file. If not create a file and add the following lines.
# WPFC NGINX CONFIGURATION - WordOps 3.14.0
# DO NOT MODIFY, ALL CHANGES WILL BE LOST AFTER AN WordOps (wo) UPDATE
# $skip_cache variable set in /etc/nginx/conf.d/map-wp.conf
add_header X-fastcgi-cache $upstream_cache_status;
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php81;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
}
location ~ /purge(/.*) {
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
access_log off;
}
Then open your site config files in "/etc/nginx/sites-available" and replace
include common/wpfc-php74.conf;
include common/wpcommon-php74.conf;
with
include common/wpfc-php81.conf;
include common/wpcommon-php81.conf;
Then run the following command to check nginx errors.
nginx -t
if everything ok, restart nginx and php8.0-fpm service.
sudo service nginx restart && sudo service php8.0-fpm restart
That's all.
If you use FastCGI disk cache, you have to add a custom location in the www.conf
and www-two.conf
files and wp-config.php. You can use this tutorial for that.