Yum update on centos 7 broke owncloud


#1

I ran yum update on my server, and owncloud was upgraded to version 10
After that I see the following message in browser:

This version of ownCloud requires at least PHP 5.6.0
You are currently running 5.4.16. Please update your PHP version.

Unfortunately php 5.6 is not in main repositories for centos 7

Server configuration
Operating system: Centos 7
Web server: apache
Database: mariadb
PHP version: 5.4.16
ownCloud version (see ownCloud admin page):
$OC_Version = array(10,0,0,12);
$OC_VersionString = '10.0.0';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array(9,1);
$OC_Build = '2017-04-26T11:44:04+00:00 ce40499f02717afa0af25bf2f67629a3159a29d3';

Updated from an older ownCloud or fresh install: upgraded
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): SSL with letsencrypt

I found this article which explains how to upgrade php
https://webtatic.com/packages/php56/

Problem is, that when I try to install php56 I get this conflict:

yum install php56w php56w-opcache

Resolving Dependencies
--> Running transaction check
---> Package php56w.x86_64 0:5.6.30-1.w7 will be installed
--> Processing Dependency: php56w-common(x86-64) = 5.6.30-1.w7 for package: php56w-5.6.30-1.w7.x86_64
--> Processing Dependency: php56w-cli(x86-64) = 5.6.30-1.w7 for package: php56w-5.6.30-1.w7.x86_64
--> Processing Dependency: php56w-cli = 5.6.30-1.w7 for package: php56w-5.6.30-1.w7.x86_64
---> Package php56w-opcache.x86_64 0:5.6.30-1.w7 will be installed
--> Running transaction check
---> Package php56w-cli.x86_64 0:5.6.30-1.w7 will be installed
---> Package php56w-common.x86_64 0:5.6.30-1.w7 will be installed
--> Processing Conflict: php56w-common-5.6.30-1.w7.x86_64 conflicts php-common < 5.6
--> Finished Dependency Resolution
Error: php56w-common conflicts with php-common-5.4.16-42.el7.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

If I try to remove the old php

yum remove php

I get a dependency conflict with owncloud.
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-42.el7 will be erased
--> Processing Dependency: php >= 5.4.0 for package: owncloud-deps-php5-10.0.0-1.1.noarch
--> Running transaction check
---> Package owncloud-deps-php5.noarch 0:10.0.0-1.1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================================================================================================================================
Removing:
php x86_64 5.4.16-42.el7 @base 4.4 M
Removing for dependencies:
owncloud-deps-php5 noarch 10.0.0-1.1 @ce_stable 397

Transaction Summary

Remove 1 Package (+1 Dependent package)

Installed size: 4.4 M
Is this ok [y/N]: n

So what to do? Force removal of php? then install php 56 and owncloud? or is there a better way?

I am also a bit confused as how version 10 was released to main repository, when the php requirements are not there.

Regards Anders, and thanks for a great product.


#2

I personally use the official CentOS Software Collections (SCL) repositories: https://wiki.centos.org/AdditionalResources/Repositories/SCL and haven't had a conflict. It contains both PHP 5.6 and PHP 7 and I have both of them installed. That's because the owncloud package depends on PHP 5.6, but I actually use PHP 7 because of the increased performance and security.


#3

Thanks for the fast reply.

I installed the repository and php56

yum install centos-release-scl
yum install rh-php56 rh-php56-php-mysqlnd

systemctl restart httpd

But it still uses the old version of php

php -v
PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

How can I tell it to use the right version?


#4

Did you run the enable and register scripts in /opt/rh/rh-php56 to enable PHP 5.6 on your system? I believe I followed the instructions here: https://doc.owncloud.org/server/latest/admin_manual/installation/php_55_installation.html#centos-7-upgrade-to-php-5-5 but you'll probably have to adapt the commands to your specific setup since this applies to PHP 5.5


#5

Thanks, you saved the day :slight_smile:

The following should help others with the same problem:

Install scl
yum install centos-release-scl

Install php56, httpd24 and other deps.
yum install rh-php56 rh-php56-php rh-php56-php-gd rh-php56-php-mbstring rh-php56-php-mysqlnd httpd24

backup olf conf files
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php54.off
mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php54.off

copy new conf files from http24
cp /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php56-php.conf /etc/httpd/conf.d/
cp /opt/rh/httpd24/root/etc/httpd//conf.modules.d/10-rh-php56-php.conf /etc/httpd/conf.modules.d/
cp /opt/rh/httpd24/root/etc/httpd/modules/librh-php56-php5.so /etc/httpd/modules/

Upgrade datebase using right php version
sudo -u apache /opt/rh/rh-php56/root/bin/php /var/www/html/owncloud/occ maintenance:mode --on
sudo -u apache /opt/rh/rh-php56/root/bin/php /var/www/html/owncloud/occ upgrade
sudo -u apache /opt/rh/rh-php56/root/bin/php /var/www/html/owncloud/occ maintenance:mode --off

...and owncloud is running again :slight_smile:


#6

@anders.collstrup Thank you for sharing those steps. We were hit by the same problem last week, but I was able to fix it by basically finding and following these same steps in various places across the Web. Good to have them all together in one place.

When you removed the package "php", did it also remove the OwnCloud package?


#7

@SmithClint I did not remove php because of the dependency issues. So I have two different versions of php installed.
The default php shipped with centos in default location. And a scl php56 version in:
/opt/rh/php56/root/bin/php

/Anders


#8

Ok, good to know. I left "php" on there as well, but replaced the CLI binaries with symlinks to the php56 folder to make it easier to use the occ commands. I also disabled updates for php, to hopefully prevent the symlinks from being overwritten. Don't want to have to go through all this again anytime soon :slight_smile:


#9

super!! anders!!

thank you, the same issue annoyed me for about 6 hours and now the solution is here.

you saved my day, thank you!