Getting error "Class 'DOMDocument' not found" in PHP - php

I'm getting an error:
Symfony\Component\Debug\Exception\FatalThrowableError: Class 'DOMDocument' not found in /var/www/html/vendor/embed/embed/src/Request.php:246
I found online that I have to install php-xml and php-dom. First, I checked my php version:
/var/www/html# php -v
PHP 7.1.33-17+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:46:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33-17+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
Then, I installed php-xml and php-dom:
sudo apt-get install php7.1-dom
sudo apt-get install php7.1-xml
And restarted nginx:
sudo service nginx restart
But it's still showing the first error. I'm three hours into this and it's driving me insane.

Related

Upgrade Php7.4 to php8 Ubuntu with Zend OPcache

How to upgrade the php version from v7.4 to v8.1. This machine is created from aws ect2 wordpress/bitnami instance.
bitnami#ip-172-31-xx-xxx:~$ php -v
PHP 7.4.22 (cli) (built: Aug 2 2021 07:35:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.22, Copyright (c), by Zend Technologies
I had alraedy tried below approach but its not upgrading with below commands
sudo apt-add-repository ppa:ondrej/php
sudo apt update
Any alternate solution to upgrade the php version ?

Install gRPC for PHP

I want to install gRPC for PHP 7.3. I followed Google Cloud documentation.
I use ubuntu 16.04, Nginx
I install:
sudo apt-get install autoconf zlib1g-dev php-dev php-pear
sudo pecl install grpc
But I am getting this error:
No releases available for package "pecl.php.net/grpc"
install failed
I don't know what is wrong.
It is php -v
PHP 7.3.22-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 9 2020 06:46:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.22-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
Please, help me.

Xdebug Ubuntu 18.04 and PHP 7.2

I just updated Ubuntu to version 18.04 and I have version 7.2 of PHP, if I execute the command "php -v" I get this result
root#laptop1:/etc/apache2/sites-enabled# php -v
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
root#laptop1:/etc/apache2/sites-enabled#
However, if I run the phpinfo() command inside a php file through a web browser I get the following: it tells me that I have version 7.1 of PHP and that I do not have the Xdebug activated.
For this reason Xdebug does not work with my PhpStorm IDE; I do not know if the best option is to delete all the PHP versions installed and leave one that is not as recent as 7.0 or 7.1.
There is a difference between what version of PHP you use in your terminal and what version your web-server (in example apache2) is using. If you have apache2, you can change the version of PHP to 7.2 with the following commands:
Dissable PHP 7.1:
sudo a2dismod php7.1
Enable PHP 7.2:
sudo a2enmod php7.2
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
After that restart apache2:
sudo service apache2 restart

Cannot install mcrypt via homebrew OSX Yosemite

Running OSX 10.10.1. I installed homebrew, and then tried running the following command:
brew install mcrypt
After which, it went through a long process of downloading/installing files. It then gave me an error:
checking for mhash_keygen in -lmhash... no
configure: error: "You need at least libmhash 0.8.15 to compile this program.
http://mhash.sf.net/"
Running php -v in terminal:
PHP 5.6.2 (cli) (built: Nov 2 2014 09:34:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Any help is appreciated. Everything seems to be breaking in OSX Yosemite...
I was experiencing the same issue and uninstalling / reinstalling mhash resolved the issue:
brew uninstall mhash
brew install mhash
After I did this I was able to properly install mcrypt.

PHP Fatal error: Class 'Memcached' not found in

php -v :
PHP 5.5.10-1+deb.sury.org~precise+1 (cli) (built: Mar 27 2014 16:18:01)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo
dpkg -l | grep php5
result
rc php5-memcache 3.0.6-1 memcache extension module for PHP5
rc php5-memcached 1.0.2-2 memcached extension module for PHP5, uses libmemcached
ii php5-mysql 5.5.10+dfsg-1+deb.sury.org~precise+1 MySQL module for php5
php.ini setting .
;;;;;;;;;;;;;;;;;;;;;;;;;
;; memchached ;;
;;;;;;;;;;;;;;;;;;;;;;;;;
extension=/usr/lib/php5/20090626/memcache.so
extension=memcached.so
memcache.hash_strategy="consistent"
but phpinfo not showing memchache details.
and php script giving PHP Fatal error: Class 'Memcached' not found in
php5-memcache and php5-memcached aren't installed. the "rc" in the dpkg output means, that the packages have been uninstalled, and that the configuration has been kept.
dpkg -l | grep php5 indicate that module is not install
ii means 'It should be installed and it is installed' whereas
rc means 'It's removed/uninstalled but it's configuration files are still there'
Use the following to install 'Memcache'
sudo apt-get install php5-memcache
Fatal error: Class 'Memcached' not found
the library might be missing, you can manually include the missing php_memcache into the ext folder

Categories