CentOS, libedit-devel not found - php

I'm trying to install sqlsrv (ms sql) PHP drivers per https://learn.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017#installing-the-drivers-on-red-hat-7
I can get all the pre-reqs installed except php-devel which requires libedit-devel which does not seem to exist.
Where can I get libedit-devel?

Install the libedit-devel lib manually.
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpm
sudo rpm -i libedit-devel-3.0-12.20121213cvs.el7.x86_64.rpm

Got this error in Centos 8.
The PowerTools repository is not enabled by default on CentOS 8 / RHEL 8 Linux. This repository contains a number of packages required as dependencies when installing other applications, and mostly building applications from source code.
To be able to enable PowerTools Repository on CentOS 8 / RHEL 8 from command line interface. First install DNF plugins package:
sudo dnf -y install dnf-plugins-core
Install EPEL repository – PowerTools repository & EPEL repository are best friends. So enable EPEL repository as well.
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Enable PowerTools Repository on CentOS 8 / RHEL 8:
sudo dnf config-manager --set-enabled PowerTools
Confirm it is enabled:
sudo dnf repolist
Then you can try to download it automatically:
yum -y install libedit-devel
https://computingforgeeks.com/enable-powertools-repository-on-centos-rhel-linux/

Related

How to install php module intl on ubunut 22.04 with two php versions active - php 8.1 and php 8.2

My worpdress website site health page dispalyas apossible improvement - php module intl missing.
My server has multiple versions of php (8.1 &8.2) active.
I use the following ssh command to install the missing intl module-
apt-get install -y php-intl
But get tis error message.
The following packages have unmet dependencies:
php8.1-intl : Depends: php8.1-common (= 8.1.2-1ubuntu2.10) but 8.1.14-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
the php modules which are active om my server , like imagick, are installed for php8.1. but my active php version is 8.2.
The problem is with the dependencies of the "php8.1-intl" package. Specifically, it requires version 8.1.2-1ubuntu2.10 of the "php8.1-common" package, but the version that is currently available is 8.1.14-1+ubuntu18.04.1+deb.sury.org+1, which is causing a conflict.
try:
sudo apt update
sudo apt-get check
sudo apt-get install -f
sudo dpkg --configure -a
5.sudo apt-get install php8.1-common=8.1.2-1ubuntu2.10
6.sudo apt-get install php8.1-intl
You may need to remove the conflicting package(s) and installing the required packages again. But be careful when removing packages as it may cause other dependencies to break.

Upgrading PHP on CentOS 6.5 (Final)

I'm trying to update my PHP (currently v:5.3.3 to the latest stable PHP build) but it's not playing ball and it's saying there is nothing to update.
Any help would be useful.
Keeps saying:
No Packages marked for Update
As Jacob mentioned, the CentOS packages repo appears to only have PHP 5.3 available at the moment. But these commands seemed to work for me...
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum remove php-common # Need to remove this, otherwise it conflicts
yum install php56w
yum install php56w-mysql
yum install php56w-common
yum install php56w-pdo
yum install php56w-opcache
php --version # Verify version has been upgraded
You can alternatively use php54w or php55w if required.
CAUTION!
This may potentially break your website if it doesn't fully resolve all your dependencies, so you may need a couple of extra packages in some cases. See here for a list of other PHP 5.6 modules that are available.
If you encounter a problem and need to reset back to the default, you can use these commands:
sudo yum remove php56w
sudo yum remove php56w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
(Thanks Fabrizio Bartolomucci)
For CentOS 6, PHP 5.3.3 is the latest version of PHP available through the official CentOS package repository. Keep in mind, even though PHP 5.3.3 was released July 22, 2010, the official CentOS 6 PHP package was updated November 24, 2013. Why? Critical bug fixes are backported. See this question for more information: "Why are outdated packages installed by yum on CentOS? (specifically PHP 5.1) How to fix?"
If you'd like to use a more recent version of PHP, Les RPM de Remi offers CentOS PHP packages via a repository that you can add to the yum package manager. To add it as a yum repository, follow the site's instructions.
Note: Questions of this variety are probably better suited for Server Fault.
I managed to install php54w according to Simon's suggestion, but then my sites stopped working perhaps because of an incompatibility with php-mysql or some other module. Even frantically restoring the old situation was not amusing: for anyone in my own situation the sequence is:
sudo yum remove php54w
sudo yum remove php54w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
It would be nice if someone submitted the full procedure to update all the php packet. That was my production server and my heart is still rapidly beating.
This is the easiest way that worked for me: To install PHP 5.6 on CentOS 6 or 7:
CentOS 6. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget https://centos6.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
CentOS 7. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
Sorry - I'm unable to post the source URL - due to reputation
Verify current version of PHP
Type in the following to see the current PHP version:
php -v
Should output something like:
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Install the Remi and EPEL RPM repositories
If you haven’t already done so, install the Remi and EPEL repositories
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm
Enable the REMI repository globally:
nano /etc/yum.repos.d/remi.repo
Under the section that looks like [remi] make the following changes:
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Also, under the section that looks like [remi-php55] make the following changes:
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Type CTRL-O to save and CTRL-X to close the editor
Upgrade PHP 5.3 to PHP 5.6
Now we can upgrade PHP. Simply type in the following command:
yum -y upgrade php*
Once the update has completed, let’s verify that you have PHP 5.6 installed:
php -v
Should see output similar to the following:
PHP 5.6.14 (cli) (built: Sep 30 2015 14:07:43)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Steps for upgrading to PHP7 on CentOS 6 system. Taken from install-php-7-in-centos-6
To install latest PHP 7, you need to add EPEL and Remi repository to your CentOS 6 system
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm
Now install yum-utils, a group of useful tools that enhance yum’s default package management features
yum install yum-utils
In this step, you need to enable Remi repository using yum-config-manager utility, as the default repository for installing PHP.
yum-config-manager --enable remi-php70
If you want to install PHP 7.1 or PHP 7.2 on CentOS 6, just enable it as shown.
yum-config-manager --enable remi-php71
yum-config-manager --enable remi-php72
Then finally install PHP 7 on CentOS 6 with all necessary PHP modules using the following command.
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
Double check the installed version of PHP on your system as follows.
php -V
IUS offers an installation script for subscribing to their repository and importing associated GPG keys. Make sure you’re in your home directory, and retrieve the script using curl:
curl 'https://setup.ius.io/' -o setup-ius.sh
sudo bash setup-ius.sh
Install Required Packages-:
sudo yum install -y mod_php70u php70u-cli php70u-mysqlnd php70u-json php70u-gd php70u-dom php70u-simplexml php70u-mcrypt php70u-intl

struggling to install PHP pecl on Centos

I'm trying to install the php_http PHP extension on my CentOS server.
I have done:
yum install php-pear
But get:
No package php-pear available
Yet I can do:
pear
And get a list of commands from Pear.
Same for yum install pecl. I can do pecl but pecl install pecl_http returns:
No releases available for package "pecl.php.net/pecl_http"
install failed
Yet /usr/bin/pecl isn't a directory that exists. Also a sudo pecl install pecl_http returns sudo: pecl: command not found, which I find quite odd.
I'm not entirely sure what's going on here/what I'm doing wrong.
edit: I am using the following repos:
base CentOS-6 - Base
epel Extra Packages for Enterprise Linux 6 - x86_64
extras CentOS-6 - Extras
rpmforge RHEL 6 - RPMforge.net - dag
updates CentOS-6 - Updates
vz-base vz-base
vz-updates vz-updates
On CentOS,
Install PHP Pear if not installed yet:
# yum install php-pear
Install GCC if not installed yet:
# yum install gcc
Install cURL if not installed yet:
# yum install curl-devel
Install following libraries if not installed yet:
# yum install php-devel
# yum install zlib-devel
# yum install pcre-devel
Start the main installation:
# pecl install pecl_http
Add the following line to /etc/php.ini file
extension=raphf.so
extension=propro.so
extension=http.so
Restart apache server so the extension can be loaded
# service httpd restart
You can check if it installed successfully or not:
# pecl list
Step 1) import the REMI repo
CentOS 5
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm;
CentOS 6
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm;
Step 2) install php-pear
yum --enablerepo=remi,remi-php55 install php-pear
Step 3) install pecl_http
pecl install pecl_http
For other people having this problem. I discovered this question while trying to figure out why I was having the same problem. Turned out the default configuration at my hosting provider was to include php* in the exclude directive for yum. Check /etc/yum.conf and make sure that the package you're trying to install isn't matched by an entry in the exclude directive.
if you are running php 7 you might want to try this
yum install php70w-pear
if you get any errors, be sure to uninstall the pear package from any previous attempts
yum remove php-pear
best of luck
If you are using php 5.4.x, IMO best repo to use is iuscommunity. Its very stable and used by Rackspace to do only PHP and a few other packages for CentOS.
rpm -Uhv http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
yum install php54-pear
Mind you, the reason why its php54-pear and not php-pear is because 5.3 and 5.4 both are compiled in the repository. Here is the list of php packages -> http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/repoview/development.languages.group.html
I tested this and it works, but I only use EPEL and iuscommunity REPO's. I avoid using rpmforge myself.
Centos 6.5 and php7:
sudo su -
yum install yum-utils
you can get last version of lua : http://pecl.php.net/package/lua
wget http://pecl.php.net/get/lua-2.0.4.tgz
tar -xvzf lua-2.0.4.tgz
cd lua-2.0.4
mkdir /usr/include/lua
mv * /usr/include/lua
yum install gcc
yum install php70w-pearl php70w-devel
yum install curl-devel
yum install zlib-devel
yum install pcre-devel
ln -s /usr/include/lua.h /usr/include/lua/lua.h
rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm
yum-config-manager --enable remi-php70
yum update
yum --enablerepo=remi,remi-php70 install php70w-pear
yum install lua-devel lua-static
pecl install lua-2.0.4
Whatever your PHP provider is (IUS, Remi or Webtatic), the pear package and the pecl extensions "should" be available there, without any need to compile it from sources (which is usually discouraged, especially on production)
At least "remi" provides most extensions, see the list
So installation should be as simple as
yum install php-pecl-http
yum install php-pecl-lua
etc
And, don't forget to read the Wizard instructions
I tried almost everything on this list before I finally realized that my WHM/cPanel installation was blocking the yum packages. I have to install all PECL modules (I was stuck trying to install mongodb on this particular occation) through the Home > Software > Module Installers inside WHM (cpanel documentation says that you have to be logged in as root).
After watching a lot of threads and installing pear and all the devtool, I finally solved it installing this extension:
yum install php-pecl-mongo
as I seen in - https://madcoda.com/2012/12/install-mongodb-php-driver-in-centos-6-3/

Install php-mcrypt on CentOS 6

I have been trying to install php-mcrypt for a while now. Everytime I get the "No package php-mcrypt available." returned to me. Here's what I've tried:
root#ip-********** [~]# yum install php-mcrypt --enablerepo=centosplus (<- both with and without this)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: p3plmirror01.prod.phx3.secureserver.net
* centosplus: p3plmirror01.prod.phx3.secureserver.net
* epel: mirrors.solfo.com
* extras: p3plmirror01.prod.phx3.secureserver.net
* updates: p3plmirror01.prod.phx3.secureserver.net
centosplus | 3.5 kB 00:00
centosplus/primary_db | 746 kB 00:00
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do
I have made sure to install the EPEL repository. At this point I'm just stumped. I've followed EVERY tutorial I've found online and get the same error.
Notes: GoDaddy VPS, CentOS 6.4 64-bit, mcrypt installed without a hitch, but no php-mcrypt.
I had the same issue, and found the previous suggestions gave me enough info to get it working on my server. The following is what I did:
1) Install EPEL repository (From: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x):
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
yum update
yum install php-mcrypt*
The yum update updated the repository reference on my server then the 2nd command got what I needed :)
3) Restart your webserver. For my apache install I did:
service httpd restart
For me the answer was:
1) Get the Repos from
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
sudo yum update
sudo yum install php-mcrypt*
3) Edit the mcrypt.ini
sudo nano /etc/php.d/mcrypt.ini
add this
extension=/usr/lib64/php/modules/mcrypt.so
Finally
4) Restart your webserver:
sudo service httpd restart
I run this steps in CentOS 6.3 (64) on Azure From Microsoft Linux image
Hope it helps you.
Best Regards.
Updated Answer for centos 7
## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
# rpm -ivh epel-release-7-0.2.noarch.rpm
For CentOS 6
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
Install
yum install php-mcrypt
Edit: See comments for updated repositories.
yum install php-mcrypt.x86_64
worked for me instead of
yum install php-mcrypt
I was able to figure this out; it was a lot simpler then I thought. Under the WHM manager go to: Home >> Software >> EasyApache (Apache Update) >> There you have two options "Build Profile" or "Customize Based On Profile". I went Customize to keep my current config then followed the instructions on the page.
Eventually there was a place to add and remove php modules. There you will find ever module under the sun. Just select the one you want and rebuild the profile. It was really that simple.
I got too much problem in installing php-mcrypt using epel-release-6-8.noarch.rpm. It has some dependency problem.
Then I tried in different way.
Get the php-mcrypt using "wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm" command.
Then install libmcrypt
ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
The installed php-mcrypt using following command
yum install php-mcrypt-5.3.3-3.el6.x86_64.rpm
If php_mcrypt installed on 64bit but reported missing by an installer, check the extension path:
vi /etc/php.d/mcrypt.ini
; Enable mcrypt extension module
;extension=module.so
extension=/usr/lib64/php/modules/mcrypt.so
To install mcrypt from http://namhuy.net/641/centos-6-install-mcrypt-for-phpmyadmin.html
i386
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
x86_64
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
then just use yum command to install the mcrypt package
yum install php-mcrypt
The best way is to:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
yum localinstall php-mcrypt-5.3.3-3.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
yum localinstall libmcrypt-2.5.8-9.el6.x86_64.rpm
or go to: http://dl.fedoraproject.org/pub/epel/6/x86_64/ to match your version
check from your info.php that is ok -- done!
There are two ways you can address this:
Download php-mcrypt from fedora:
http://injustfiveminutes.wordpress.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
Check if you're facing a known bug with a wrongly packaged php-mcrypt extension:
http://www.sterndata.com/blog/phymyadmin-mcrypt-and-centos-6-mcrypt-extension-missing-solved
For me I had to add the EPEL repository. It is where my php-mcrypt came from:
[root#system ~]$ repoquery -i php-mcrypt
Name : php-mcrypt
Version : 5.3.3
Release : 1.el6
Architecture: i686
Size : 39225
Packager : Fedora Project
Group : Development/Languages
URL : http://www.php.net/
Repository : epel <----------
Summary : Standard PHP module provides mcrypt library support
Source : php-extras-5.3.3-1.el6.src.rpm
Description :
Standard PHP module provides mcrypt library support
You can enable the EPEL repo with the instructions here:
http://fedoraproject.org/wiki/EPEL
installing php-mcrypt from Repoforge worked for me perfectly. Just add Repoforge from http://repoforge.org/ and simply run yum install php-mcrypt.
For me, this worked :
yum install php-mcrypt*
and then, restart httpd service
service httpd restart
I tryed #VenomFangs solution but the first step was not needed for me. I already had a newer EPEL version installed. So, the first step following was not usefull, I backed to the snapshot I did before doing modifications and I just used the install and restart above commands.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
CentOS Linux release 7.2.1511 (Core)
PS : I know this is not the subject, but if somebody needs it, the keyword can help. I needed to do this because of this error on prestashop. Two keywords I would be glad to use to find this informations are : "php_mycrypt.dll" "php_mcrypt.dll"
Fatal error: Call to undefined function mcrypt_encrypt() in /classes/Rijndael.php on line 46
EDIT 10/06/2016 :
Another Prestashop solution to try in "Advanced Parameters", "Performance", "Ciphering" (FR : Chiffrement), "Use the custom BlowFish class." instead of "Use Rijndael with mcrypt lib. (you must install the Mcrypt extension)."
First find out your PHP version. In my case 5.6.
php --version
PHP 5.6.27 (cli) (built: Oct 15 2016 21:31:59)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Then:
sudo yum search mcrypt
And choose the best one for your version from the list, I used php56w-mcrypt.
$ sudo yum search mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..... output truncated ....
libmcrypt-devel.i686 : Development libraries and headers for libmcrypt
libmcrypt-devel.x86_64 : Development libraries and headers for libmcrypt
libtomcrypt-devel.i686 : Development files for libtomcrypt
libtomcrypt-devel.x86_64 : Development files for libtomcrypt
libtomcrypt-doc.noarch : Documentation files for libtomcrypt
php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php55w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
# either of these are fine:
php56-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php56w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
libmcrypt.i686 : Encryption algorithms library
libmcrypt.x86_64 : Encryption algorithms library
libtomcrypt.i686 : A comprehensive, portable cryptographic toolkit
libtomcrypt.x86_64 : A comprehensive, portable cryptographic toolkit
mcrypt.x86_64 : Replacement for crypt()
```
Finally:
sudo service httpd restart
I was having same issue in centos 6.5
Finaly solution below worked for me
-go to http://dl.fedoraproject.org/pub/epel/6/x86_64/
-search for php-mcrypt(http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm)
-execute wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
-rpm -ivh php-mcrypt-5.3.3-3.el6.x86_64.rpm
if there are any dependencies you can download same using http://dl.fedoraproject.org/pub/epel/6/x86_64/
For php 7 to install mcrypt run:
Centos:
sudo yum install php7.0-mcrypt to install
On Ubuntu:
sudo apt-get install php7.0-mcrypt
If you want to recompile PHP with mcrypt enable.
1.
Insatll mcrypt. libmcrypt-devel is from Third Party Repositories EPEL, so you should:
yum --enablerepo=extras install epel-release
yum install libmcrypt-devel
2.
Append --with-mcrypt to your ./configure arguments:
./configure --with-mcrypt
3.
Build and install:
make & make install
Try
yum clean all
yum remove epel-release
yum install epel-release
and finally
yum install php-mcrypt

Class 'DOMDocument' not found

I've found an error on a page in my Magento application; it always show this message error when I visit it:
Fatal error: Class 'DOMDocument' not found in /home/.../lib/Zend/Feed/Abstract.php on line 95
Can you give me a solution? I'm using magento 1.4.1.1.
You need to install the DOM extension. You can do so on Debian / Ubuntu using:
sudo apt-get install php-dom
And on Centos / Fedora / Red Hat:
yum install php-xml
If you get conflicts between PHP packages, you could try to see if the specific PHP version package exists instead: e.g. php53-xml if your system runs PHP5.3.
PHP 8.2
Ubuntu: apt-get install php8.2-xml
CentOS 8 [with php:remi-8.2 enabled]: dnf install php-xml
PHP 8.1
Ubuntu: apt-get install php8.1-xml
CentOS 8 [with php:remi-8.1 enabled]: dnf install php-xml
PHP 8.0
Ubuntu: apt-get install php8.0-xml
CentOS 8 [with php:remi-8.0 enabled]: dnf install php-xml
PHP8: (latest version)
sudo apt-get install php8.0-xml
PHP7:
sudo apt-get install php7.1-xml
You can also do:
sudo apt-get install php-dom
and apt-get will show you where it is.
Package php-dom is a virtual package provided by:
php7.1-xml 7.1.3+-3+deb.sury.org~xenial+1
php7.0-xml 7.0.17-3+deb.sury.org~xenial+1
php5.6-xml 5.6.30-9+deb.sury.org~xenial+1
You should explicitly select one to install.
In case anyone using 5.6 versions then go with this way
sudo apt-get install php5.6-xml
For PHP ver PHP7, Ubuntu:
sudo apt-get install php7.1-xml
or by
yum install php-xml
I'm using Centos and the followings worked for me , I run this command
yum --enablerepo remi install php-xml
And restarted the Apache with this command
sudo service httpd restart
After a long time suffering from it in PHPunit...
For those using namespace, which is very common with Frameworks or CMS, a good check in addition to seeing if php-xml is installed and active, is to remember to declare the DOMDocument after the namespace:
namespace YourNameSpace\YourNameSpace;
use DOMDocument; //<--- here, check this!
Create an empty PHP file and put only <?php phpinfo(); in it, look at it in a browser.
Check if you can spot --disable-dom in the configuration options and/or if you can see details about the DOM extension in the list below.
If you cannot see DOM in the list or you see it is disabled, your PHP installation does not include the DOM extension. You'll need to recompile your PHP installation from source to remedy that.
In my case the problem was it was the use of namespace at the top of php file, exemple :
namespace MediaWiki\Extensions\ParserFunctions;
To solve this problem add the following line:
use DOMDocument;
So no need of installing dom or xml if they are already installed. It is a php language trap.
This help for me (Ubuntu Linux) PHP 5.6.3
sudo apt-get install php5.6-dom
Thats work for me.
For PHP 7.4 Install the DOM extension.
Debian / Ubuntu:
sudo apt-get update
sudo apt-get install php7.4-xml
sudo service apache2 restart
Centos / Fedora / Red Hat:
yum update
yum install php74w-xml
systemctl restart httpd
For previous PHP releases, replace with your version.
Using Suse Linux (Linux linux 3.16.7-48-default) and PHP 5.6.1 as root, this helped:
zypper in php5-dom
plus restart
systemctl restart apache2
On fedora 26:
dnf install php-dom
Fixes it !
If compiling from source with --disable-all then DOMDocument support can be enabled with
--enable-dom
Example:
./configure --disable-all --enable-dom
Tested and working for Centos7 and PHP7
I'm using CentOS 7 with virtualmin and three PHP versions. I also have REMI repo enabled. it worked for me:
Step 1:
Just append PHP major version number like this php{version number}-xml. And run yum install
yum install php70-php-xml
yum install php71-php-xml
yum install php72-php-xml
Step 2:
Don't forget to restart Apache:
service httpd restart
On a Amazon Linux 2 with PHP 8.0, I had to
yum-config-manager --enable remi-php80
yum install php-xml
Do not forget to restart PHP
systemctl restart php-fpm
For Centos 7 and php 7.1:
yum install php71w-xml
apachectl restart
If you are using PHP7.0 to install Magento, I suggest to install all extensions by this command
sudo apt-get install php7.0 php7.0-xml php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql php7.0-gd libapache2-mod-php7.0 php7.0-intl php7.0-soap php7.0-zip php7.0-bcmath
I need to Google some times to meet Magento requirement.
I think you can replace the PHP version to 7.x if you use another PHP version
And restart Apache is needed to load new extensions
sudo service apache2 restart
PHP 7.X Centos 7
I got dependency issues when trying to install module with above suggestions, adding this flag:
--enablerepo=remi-php7X
Resolved dependencies.
So
sudo yum --enablerepo=remi-php7X install php-xml
Then
service httpd restart
Ref:
Install PHP Modules
this is the lastest for php v 8.0
sudo apt-get install php8.0-xml

Categories