Change PHP version from 7.2.33 to 7.4

Hi @ll !

I want to update my php version from 7.2 to 7.4 on a LEMP based system (Ubuntu 18.04, NC 18.0.7, mysql 10.1.44).
I already installed the packages as mentioned in the second chapter of this guide :

works fine,

but i still have to change the php version in nginx… How can i do that?


In apache it was something like:
a2dismod php7.2
a2enmod php7.4

Thx for your help!

Maybe this link link can help?

good luck :slightly_smiling_face:

Sorry i do not understand you.

Why do you not dist-upgrade your Ubuntu from Ubuntu 18.04 LTS to 20.04 LTS.

Ubuntu 18.04 LTS (php 7.2)
Ubuntu 20.04 LTS (php 7.4)

Yes Ubuntu 18.04 LTS is still supported.
But all users are now dist-upgrading to Ubuntu 20.04 LTS.

Could you please post the content of your nginx configuration file.
I assume the fastcgi_pass entry or server entry refers still to the php7.2 fpm socket.

Hi tuxedo-rb,

The file:

cloudadmin@Cloudhost:/etc/nginx$ nano nginx.conf

GNU nano 2.9.3 nginx.conf

user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/;
events {
worker_connections 1024;
multi_accept on;
use epoll;
http {
server_names_hash_bucket_size 64;
upstream php-handler {
server unix:/run/php/php7.2-fpm.sock;
include /etc/nginx/mime.types;
include /etc/nginx/proxy.conf;
include /etc/nginx/ssl.conf;
include /etc/nginx/header.conf;
include /etc/nginx/optimization.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] “$request” $status $body_bytes_sent “$http_referer” “$http_user_agent” “$http_x_forwarded_for” “$host” sn="$$
access_log /var/log/nginx/access.log main;
sendfile on;
send_timeout 3600;
tcp_nopush on;
tcp_nodelay on;
open_file_cache max=500 inactive=10m;
open_file_cache_errors on;
keepalive_timeout 65;
reset_timedout_connection on;
server_tokens off;
resolver x.x.x.x;
resolver_timeout 10s;
include /etc/nginx/conf.d/*.conf;

Tx for your help!
I think I have to change the server unix:/run/php/php7.2-fpm.sock; to 7.4, am I right?


Have you read my post? Why do you not change to Ubuntu 20.04 LTS?

Why should i…

as mentioned above, the php version on my ubuntu 18.04 is currently 7.4, as you can see in the screenshot…

I want to point the webserver to the new php version in nginx.

So I think, you didn’t read my post my friend :wink:

I dont want to update to 20.04 yet.

change the line:
server unix:/run/php/php7.2-fpm.sock;
server unix:/run/php/php7.4-fpm.sock;

Then restart nginx.
service nginx restart


ok, perfect,

i will try this later.
I think i will have to change the php version in several files, for example the lets encrypt

Thank you


That is ok. But every version of software has got system requirements. I think with Nextcloud 20 the Nextcloud GmbH changes recommendation from Ubuntu 18.04 LTS to 20.04 LTS.

For Nextcloud 19 the recommended php versions 7.3 and 7.4 are not in the standard ubuntu 18.04 LTS repository.

Nextcloud 19 with Ubuntu 20.04 LTS, nginx and standard repository for e.g. php:

He added Ondřej Surý PPA which acts as backport Repo for PHP and many extensions.

Yes. And that is ok. But Ubuntu is not Windows XP with a release time of +10years and all DLLs are changed in release time. Ubuntu has got a 2 year release time and after 2 years you get all new packages like php-version 7.4. Perhaps with Nextcloud 20 and Ubuntu 18.04 LTS you must change much more packages like Windows XP style.

And yes. You have 2 years time to change from Ubuntu 18.04 LTS to 20.04 LTS if there is no problem with the software you want to use on the Ubuntu platform. But normally if you only have one software (or one service like Nextcloud with nginx and MariaDB) on your server and not thousands of servers you can change early.

Well, even Ubuntu 16.04 LTS is not EOL yet. ESM starts somewhen next year.
But yeah, at least with beginning of ESM phase i would also update.

(sorry for offtopic)