laravel class memcached not found - php

First of all , I have looked at all of these :
#1 , #2 , #3
and none of them is my case nor has really a soloution.
The problem is that I am developing a website by laravel 5.3.18 and here is the PHP info running on my server:
PHP 7.0.9-2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.9-2, Copyright (c) 1999-2016, by Zend Technologies
And also here is my server OS info if you need to take a look at:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux stable-updates (sid)
Release: stable-updates
Codename: sid
I need to change CACHE_DRIVER to memcached in order to use this package(according to what they say in the GitHub issues about fixing the found bug).
Here is where all my problems started.
I have thses memcahed packages installed on my server(listed by dpkg --list):
I see everyone is talking avout installing php5-memcached but shockingly when I try to install php5-memcached I get this:
and tha's after running sudo apt-get update!
I even get this after entering sudo service memcached status:
After all of these when I change the CACHE_DRIVER to memcached, it keeps on showing this error:
While I am still struggling with this, Any ideas on this guys? I would be appreciative!

It's possible that the memcached.ini is being copied to the PHP5 module config directory.
Try this:
ln -s /etc/php/mods-available/memcached.ini /etc/php/7.0/fpm/conf.d/20-memcached.ini
You might copy msgpack.ini too:
ln -s /etc/php/mods-available/msgpack.ini /etc/php/7.0/fpm/conf.d/20-msgpack.ini

Class Memcached is also used by php 7 (PHP 7 with memcached)
Check this out - http://pecl.php.net/package/memcached
You may need to also install libmemcached see this - https://launchpad.net/libmemcached/+download
Or see the similar issue on - StackOverflow

Related

Install xdebug on specific php version

I'm trying to install xdebug.
I've already seen some issues about it (like this one : Installing xdebug with PHP 5.5 ) but it seems outdated and not corresponding to my issue).
When I try
sudo pecl install xdebug
I'm getting the following error
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.8.0.tgz ...
Starting to download xdebug-2.8.0.tgz (238,122 bytes)
.................................................done: 238,122 bytes
69 source files, building
running: phpize
sh: 1: phpize: not found
ERROR: `phpize' failed
It seems that means phpize isn't installed in my php version
php -v
PHP 7.2.24-0ubuntu0.19.04.1 (cli) (built: Oct 24 2019 11:49:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.19.04.1, Copyright (c) 1999-2018, by Zend Technologies
So, some topics seems to tell me to change my php version to download a version with phpsize included. But I was more looking for a way to add phpsize to my current php version but I don't know how to do that.
Thanks for your assistance
If Ubuntu first you need install php dev version:
sudo apt install php7.x-dev
And then:
sudo pecl install xdebug
I had some problems with xdebug version too.
I had to install an specific version for php7.1 using PECL,
I don't really know if your question is already solved but let me share you this webpage, it's the compatibility graph to know wich version works with an specific php versions:
https://xdebug.org/docs/compat
As far as I know if you want to install the latest xdebug version you can use the repo, but if you need an old version you'll be forced to install it using PECL.
Hope you find this answer usefull!

Why is php zip extension not working on ubuntu though it's installed?

I'm on Ubuntu 16.04 and I'm trying to install prestashop e-commerce CMS that requires php zip extension to unzip the main CMS folder.
I have installed php-zip and php7.2-zip and I also restarted the web server (apache2) but the CMS still displays the following message
An error has occured:
You must install PHP zip extension first
Here's the result of my installed php zip packages and my current php version:
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ php -v
PHP 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 5 2018 04:59:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ apt list --installed | grep php | grep zip
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
php-zip/xenial,xenial,now 1:7.2+60+ubuntu16.04.1+deb.sury.org+1 all [installé]
php7.2-zip/xenial,now 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 amd64 [installé]
I spent an hour and a half trying to figure out whether I need to activate the extestion on the php.ini file and also installing and reinstalling and restarting the web server but nothing seems to work.
I have tried a few solutions on the web that used to work for me but I can't seem to find a good solution.
Please help me with your experience!
I've found the solution after I printed the results of the phpinfo() function.
It seems that the version of php printed with the "php -v" command is not the version that actually apache is using. Apache ended up using the 7.0 version.
Thanks everyone.

Class Memcached Not Found Lumen 5.4

When trying to run artisan commands I get the following error
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Memcached' not found
I had recently been been working on another project that used Lumen 5.3 and had no problem running artisan commands. Both projects are on the same virtual box and apart from the Lumen versions there is no differences in server setup.
I've checked that Memcached is running and there is no problems.
I've tried composer dump-autoload, deleting the vendor folder and re-installing but none of these have made a difference.
I'd prefer not to have to go back to 5.3 if possible.
Is there a way to solve this issue?
Had the same problem.
Check if you have the memcached extension installed for the php version that you're using, and check also if it is correctly configured in the php.ini file (it could be looking in the wrong directory).
looks like your memcahed is not installed or not properly configured.
for quick solution ,
use file cache driver instead of memcached
CACHE_DRIVER=file
Ubuntu 16.04 LTS, try this:
sudo apt-get install php-memcached
Just to add to the os specific responses. Here is the one using OS/X and homebrew.
First you have to determine which version of PHP you're using locally.
$ php -v
PHP 7.0.19 (cli) (built: May 21 2017 11:56:11) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
$ brew search memcached
homebrew/php/php53-memcached homebrew/php/php70-memcached
homebrew/php/php54-memcached homebrew/php/php71-memcached
homebrew/php/php55-memcached libmemcached ✔
homebrew/php/php56-memcached memcached ✔
Since I'm running PHP 7.0 I chose to install homebrew/php/php70-memcached
$ brew install homebrew/php/php70-memcached
If you don't have homebrew installed go to https://brew.sh/ and install it to use these instructions. This was the command last time I used it.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once I was done with all that then I tested by clearing the cache.
$ php artisan cache:clear
Cache cleared successfully.
$
Cheers, this fixed it for me for local development.
If you are on Mac OSX, you will need to install Memcached and its PHP dependencies via Homebrew.
brew update
brew doctor
brew install memcached
Then check your PHP version and install your relevant PHP hooks for Memcached.
php -v
in my case...
PHP 7.1.4 (cli) (built: Apr 14 2017 15:02:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
So I used:
brew install php71-memcached
But you can lookup your required version using
brew search memcached
Once you have performed these steps you will probably get a new error
No Memcached servers added.
So fire it up with
brew services restart memcached
Done!

No package php-opcache available

I found so many questions here but whatever i try i always get the msg
No package php-opcache available
i tried to follow this
http://www.unixmen.com/install-remi-repository-rhel-centos-scientific-linux-76-x5-x-fedora-201918/
then install opcache
# yum install php-opcache
but still no luck
PS: i have WHM/Cpanel installed on my AWS server and i need to install opcache for Magento
i have PHP version 5.5
PHP 5.5.35 (cgi-fcgi) (built: May 16 2016 18:26:28)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
i tried to enable it from php.ini but it says opcache.so not found
any help would be appreciated
Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: cannot open shared object file: No such file or directory
If you're installing from Remi's repo, the name will be php55-php-opcache, which you could have determined from running yum search opcache.
But your error refers to /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so which tells me that you have a version of PHP that was compiled from source. You need to either use packages or compile from source, not both. If you install from a package, things will not be put into /usr/local/.

Mcrypt not installed with Laravel Homestead

I've just moved from a WAMP installation to Homestead and I can't get my app running.
When running composer install I get this error:
Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'
Many people seem to have problems with that but most of them use custom installation (they install php from scratch for example). I have just followed the steps here.
I tried to grep mcrypt from php --info and not a single line is returned so I assumed mcrypt is not install.
I've run sudo apt-get install php5-mcrypt and it says:
php5-mcrypt : Depends: phpapi-20121212
I could try to install this dependency but I'm wondering if I'm doing something wrong (the point of using Homestead was to get rid of everything but the project itself, I assume).
The php version used in the vm:
PHP 7.0.2-4+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans
(Not sure why it's php 7, I've never asked for that.)
Any help would be greatly appreciated :)
The latest Homestead with PHP7 does not support Laravel 5.0, out of the box.
As mentioned above in the comments this worked:
git clone -b 2.0 https://github.com/laravel/homestead.git

Categories