How to update PHP NC 19.0.0?

Updating your packages is a regular task you have to perform on a server. You are a server admin now, get used to it.

If “apt update” tells you there are there are packages to be upgraded, you should do that. Expect upgradable packages on a weekly basis.

So please run

sudo apt upgrade

and tell us about the results.

@eehmke,

What i don’t get is that i have used the command apt update a couple of times since i started this topic. But now this time something seems to happen.

It asks me to replace http2.conf, as far as i know i have to keep my current versions on all these questions during updating, right?

(It also says DEFAULT = NO , so keep. But i want to be sure)

Debian/Ubuntu will take care that the upgraded versions are compatible. Most of the times, the upgraded versions are security related.

I have the package apticron installed, that sends me an email when upgradable versions of some packages are available. I get several emails a week, and I keep all my servers up to date.

If you have not done changes to http2.conf, you can install the new version with no risk. If you did change it, you may have to redo the changes to the new version. “apt upgrade” will give you some hints to check the differences.

@eehmke,

I cannot remember if i have made any changes to be honest. i went for NO, the result is:

The following NEW packages will be installed:
libbrotli1
The following packages have been kept back:
libapache2-mod-php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache
php7.4-readline
The following packages will be upgraded:
apache2 apache2-bin apache2-data apache2-utils libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap
7 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.

After this i tried to install php7.4 FRM again.
sudo apt install php7.4-fpm still gives me:

Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php7.4-fpm : Depends: php7.4-common (= 7.4.7-1+ubuntu18.04.1+deb.sury.org+1) but 7.4.6-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

By the way Apticron sounds like a good option!

@eehmke,

I am a bit further, i think im pretty close now could you or someone else tell me wat to do next?

I have installed PHP7.4-FRM by using:

apt-get install libapache2-mod-php7.4 libapache2-mod-php7.4 php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-fpm php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-pgsql php7.4-readline php7.4-sqlite3 php7.4-xml php7.4-zip php7.4-bcmath php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-fpm php7.4-gd php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-zip php7.4-gmp

When i do apt-get install php7.4-fpm it now shows:

php7.4-fpm is already the newest version (7.4.8-1+ubuntu18.04.1+deb.sury.org+3).
0 upgraded, 0 newly installed, 0 to remove and 45 not upgraded.

When i do a2enmod php7.4
Considering dependency mpm_prefork for php7.4:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.4:
Module php7.4 already enabled

So it looks like 7.4 is finally installed correcty.
PHP -v is also showing PHP 7.4.8 (but it already did that)

This is a little weird:

a2dismod php7.3
ERROR: Module php7.3 does not exist!

a2dismod php7.2
ERROR: Module php7.2 does not exist!

Nextcloud shows me that PHP 7.2.31 is installed.

What should i do next? Like i said it finally looks like PHP7.4 is fully installed.

If you are using php7.4-fpm, you don’t need, and should not enable, the php7.4 apache module. So you please a2dismod it too.

The interface to php is done via a socket, that is defined in /etc/php/7.4/fpm/pool.d/www-nextcloud.conf (your filename may vary)

Look for the “listen” line, there you find the socket definition. This socket must be refered in your apache vhost configuration.

Tell us your progress.

@eehmke,

I have done a2dismod php7.4, like you said.

When i look at file /etc/php/7.4/fpm/pool.d/(my file name is www.conf)
it says:

listen = /run/php/php7.4-fpm.sock

When i look at /etc/apache2/sites-available/000-default.conf
Then i see SetHandler "proxy:unix:/run/php/php7.2-fpm.nextcloud…

Is that the line you want me to change?

Yes exactly that line must match. Adapt the line in the apache configuration to the 7.4 socket.

@eehmke,

I have added the line and ran systemctl restart apache2. But Nextcloud is still telling me i am running PHP 7.2.31.

I have also copied nextcloud.conf from /etc/php/7.2/fpm/pool.d/ to /etc/php/7.4/fpm/pool.d/.
and changed : listen /run/php7.2-fpm.nextcloud.sock to /run/php7.4-fpm.nextcloud.sock

Would should i do next?

You also need to restart the php7. 4-fpm service.

@eehmke,

I forgot to mention that i also did that.

If your nextcloud still runs on php7.2, somewhere in the chain there is a missing link. Is the /etc/apache2/sites-available/000-default.conf file really the one that serves nextcloud? Are there other files in /etc/apache2/sites-available/ ? What files are in /etc/apache2/sites-enables ? There should be only symlinks to the actual configuration files, but in case of a bad setup there might be real files that take priority.

Check that the socket /run/php/php7.4-fpm.sock indeed exists. Make sure your apache config is using it.

1 Like

@eehmke,

I have a gut feeling we are so so so close… :stuck_out_tongue:

In the directory /etc/apache2/sites-enabled there is only one file: cloud.DOMAIN.nl.conf

When i look at that file i again see this:
SetHandler "proxy:unix:/run/php/php7.2-fpm.nextcloud…

when i change this to 7.4 and restart apache2 en php7.4-fpm… Nextcloud finally tells me i am using PHP 7.4.8!!

Many many thanks to you @eehmke and of course everybody else!

I am having one tiny problem now, i have to set the maximum memory to 256MB according to my Nextcloud.

I have changed /etc/php/7.4/apache2/php.ini and the line memory_limit but that is not working.

I also tried this command:
sudo snap set nextcloud php.memory-limit=512M

but also didn’t work.

Could you tell me where to change this value?

And a related update question, i am running Ubuntu 18.04.1 LTS shouldn’t i at some point upgrade to a newer LTS version? Is that also possible or does that mean reinstalling the whole shabang? Like a Windows 7 to Windows 10 clean install?

Great, nice to know it works now! You have to do one final step to clean your config: compare the files in sites-available and sites-enabled. Make sure the content of the file in sites-enabled is also in sites-available. Then DELETE the file in sites-enabled! Next you run this command:
sudo a2ensite cloud.DOMAIN.nl
(put in your file name without the .conf extension). This will create a symlink in sites-enabled. All future updates have to go to sites-available. Restart apache.

You can put those definitions into your fpm config file in /etc/php/7.4/fpm/pool.d/
like:

php_admin_value[memory_limit] = 512M

I think upgrade should be no problem. But make sure you backup all relevant data, in case something goes wrong (which I would not expect). Backup is always a good idea. It should include:

  • config files in /etc
  • nextcloud installation in /var/www/nextcloud
  • data directory (which should not be in /var/www/nextcloud)
  • dump of the database

And if all stuff works, give me a like and mark my post as solution please!

1 Like

@eehmke,

I have checked the file in sites-enabled. This had the same content (/ was the same file) as in sites-available. So i did rm cloud.DOMAIN.nl.conf. Than i did what you told me to do sudo a2ensite cloud.DOMAIN.nl. Now when i look in the sites-enabled folder i see the file i just deleted again. Is this okee?

Changing memory setting worked like a charme!

I have one more thing i would like to change to my Nextcloud setup. But for the sake of keeping the forum readable i will create a new topic and tag you. Because something tells me you will know what to do :slight_smile:

Again many thanks for now!

1 Like

When you look close, you will find the new file in sites-enabled is no real file, but a symbolic link to the file in sites-available. That’s the way it should be.

use command ls -l to check the symlink.

@eehmke,

How can i tell it is a symbolic link? EDIT: command ls -t indeed shows me something that tells me it is a link :slight_smile:

since you told me to do “sudo apt upgrade” often i just did that. i gave me two errors, what is the way to troubleshoot something like this / solve it?

errors:

a dependency job for hv-kvp.daemon.service failed. See journalctl -xe for details.

and

device-mapper reload ioctl on osprober-linux-sdcl failed: device or resource busy
Command failed

You can edit the original file in /etc/apache2/sites-available :wink:
You see it is a link with
ls -l ....
and then at the beginning is a “l”

or
stat <filename>

So i cannot edit a symbolic link file? always have to go to the original file?

So it is not like a (windows) shortcut?

You also can edit the file (link name) with vim, nano, …
But you also can delete it. Because of that i mostly edit the original file.

Perhaps.

But this is all a “soft link”.
There are also “hard links”.
That is another story.