Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't install any package related to PHP with yum

Tags:

php

yum

centos7

I can't install any package related PHP, I get a yum error: No package php available. My PHP version is 5.4.37 on Centos 7. I installed remi for other purposes and I think that the repository is not compatible with PHP version but I don't know how to fix it.

[root@server ~]# sudo yum install php php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centosmirror.netcup.net
 * epel: mirrors.n-ix.net
 * extras: centosmirror.netcup.net
 * remi: mirror5.layerjet.com
 * remi-safe: mirror5.layerjet.com
 * updates: centosmirror.netcup.net
No package php available.
No package php-pear available.
Error: Nothing to do
like image 760
Imran Avatar asked Dec 20 '22 00:12

Imran


2 Answers

You have, in yum configuration:

exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* ftp exim* sendmail* php* bind-chroot* 

This is very probably a "panel" enabled server (cpanel or others), which provides its own PHP stack.

So by design, you cannot install "php*" packages from standard repository or any other 3rd party repository. Such distribution is so altered, that it is often considered as "Not CentOS".

So, better to ask your php stack provider for how to update it (if possible, without breaking the panel application)

like image 97
Remi Collet Avatar answered Jan 11 '23 23:01

Remi Collet


As suggested in other answer, this may be related to excludes set in yum.conf The command below allows to run the installation of excluded packages without modifying the conf file:

yum --disableexcludes=main install php

BUT

It seems like it might be better to re-install PHP by the means of the control panel installed. IE Cpanel - EasyApache..

like image 25
user109764 Avatar answered Jan 12 '23 00:01

user109764