Reputation: 909
Could you please help me in resolving this conflict. I am tryin to run a xml_parse_create.
My server configurations:
[root@server ~]# php -v
PHP 7.0.22 (cli) (built: Aug 7 2017 16:18:27) ( NTS )
[root@server ~]# nginx -v
nginx version: nginx/1.10.2
OS: CentOS 7.3.1611 (Core)
Details of my YUM installation:
[root@server ~]# yum list installed | grep php
php70u-cli.x86_64 7.0.22-2.ius.centos7 @ius
php70u-common.x86_64 7.0.22-2.ius.centos7 @ius
php70u-fpm.x86_64 7.0.22-2.ius.centos7 @ius
php70u-fpm-nginx.noarch 7.0.22-2.ius.centos7 @ius
php70u-mysqlnd.x86_64 7.0.22-2.ius.centos7 @ius
php70u-pdo.x86_64 7.0.22-2.ius.centos7 @ius
Here is the details of the investigation:
I tried executing following code in test.php:
<?php
$xml_parser = xml_parser_create("");
print $xml_parser;<br>
?>
[root@server ~]# php /tmp/test.php
PHP Fatal error: Uncaught Error: Call to undefined function
[root@server ~]# sudo yum install php-xml
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: repo1.ash.innoscale.net
* epel: fedora-epel.mirrors.tds.net
* extras: mirror.es.its.nyu.edu
* ius: ius.mirror.constant.com
* remi-safe: repo1.ash.innoscale.net
* updates: mirrors.advancedhosters.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php-xml.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-xml-5.4.16-42.el7.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Conflict: php70u-common-7.0.22-2.ius.centos7.x86_64 conflicts php-common < 7.0.22
--> Finished Dependency Resolution
Error: php70u-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
Upvotes: 9
Views: 32205
Reputation: 634
If this is happening to you on Laravel using PHP 7.4 on CentOs, this is how you fix it:
Make sure you have the libraries installed. For that, get the packages that matches to your PHP version with the following command:
yum list php | grep xml
Install the packages that match your PHP version. As shown in the following example:
yum install ea-php74-php-xml.x86_64
Register the extensions to your php.ini file as follows:
extension=xmlwriter.so
extension=xml.so
extension=xmlreader.so
Restart your server
`sudo apachectl restart`
Add extensions to the composer.json
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlrpc": "*",
"ext-xmlwriter": "*",
Update composer
`composer update`
Et voilà!
Upvotes: 1
Reputation: 4714
Under ubuntu you can do the same as @Tarun pointed
apt-get install php-xml
apt-get search php |grep xml
Upvotes: 12
Reputation: 146540
You need to remove php-xml
and use php70u-xml
yum purge php-xml; yum install -y php70u-xml
Many people install php using some tutorial which will enable an external repo. Php gets installed using packages from this external repo. While installing extensions they try and use package names from default repo. So that is what your problem was.
Always first see where your packages are installed from
yum list installed | grep php
Then always make sure you that you choose the package which belongs to the same repo
yum search php | grep xml
Upvotes: 8