PHP Fatal error: Class 'Memcached' not found in - php

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

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.

Getting error "Class 'DOMDocument' not found" in 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.

curl not available in php CLI on Ubuntu 16.04

I have curl installed and running on php for Apache2. On command line however it does not work:
$ php test.php
PHP Fatal error: Uncaught Error: Call to undefined function curlhttp()
checking for curl:
$ php -i | grep curl
/etc/php/7.0/cli/conf.d/20-curl.ini,
curl
having a deeper look:
cat /etc/php/7.0/cli/conf.d/20-curl.ini
; configuration for php curl module
; priority=20
extension=curl.so
where is the library anyway?
$ locate curl.so
/usr/lib/php/20151012/curl.so
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4.4.0
which php version?
$ php -v
PHP 7.0.33-0ubuntu0.16.04.15 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-0ubuntu0.16.04.15, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
Let's check SO for a solution:
How to install php-curl in Ubuntu 16.04
trying to reinstall:
sudo apt install php7.0-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
php7.0-curl is already the newest version (7.0.33-0ubuntu0.16.04.15).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
$ sudo apt install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version (7.47.0-1ubuntu2.14).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
I don't see the problem. What might be the cause and how can this be fixed?

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.

Categories