My VPS came with PHP 5.4.16-43.el7_4.1 installed and I am trying to install PHP 7+, but I have been unable to do so.
Then when I try to install a library, it conflicts, as shown here:
# yum -y install php-mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repos-va.psychz.net
* epel: mirror.us-midwest-1.nexcess.net
* extras: mirrors.greenmountainaccess.net
* ius: archive.linux.duke.edu
* updates: mirror.vcu.edu
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-43.el7_4.1 for package: php-mysql-5.4.16-43.el7_4.1.x86_64
--> Running transaction check
---> Package php-pdo.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-43.el7_4.1 for package: php-pdo-5.4.16-43.el7_4.1.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Processing Conflict: php70w-common-7.0.27-1.w7.x86_64 conflicts php-common < 7.0
--> Finished Dependency Resolution
Error: php70w-common conflicts with php-common-5.4.16-43.el7_4.1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
How can I completely remove this old version of PHP?
Best Answer
It appears that you want to install a newer version of PHP-MySQL module. You need to be aware that
mysql_
library was deprecated years ago and it has been removed entirely in PHP 7. Use a modern replacement such asPDO
ormysqli_
instead. See this answerIf you are using CentOS 7, I recommend that you use IUS repository rather than webtatic. So you can disable or remove webtatic repo. I also recommend you remove packages installed from it. For example:
Now install php7 after disabling or removing webtatic repo.
For php7.1*
For php7.2*
Try to see if MySQL is supported:
If you see
php71u-mysqlnd.*
for example, it is already supported.