Laravel 5 memcached not found while properly installed - php

I have PHP 5.4 on a litespeed web server. PHP has been compiled properly with memcached module and we also installed properly memcached library.
In fact the problem suddenly happened without any change at all (server side) when I run the artisan command, I am getting this error:
PHP Fatal error: Class 'Memcached' not found in /laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 52
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Memcached' not found
I googled the issue but was unable to find a solution. I am using Laravel 5.0.
I edited the app/Http/Routes.php and returned new Memcached at the top of the file and the php object was returned so it means memcached is properly installed on the server...
Any help would be appreciated.

Found the solution. My problem was when I was running the artisan command, the artisan was using another version of PHP (different than the Litespeed one) and this PHP was not compiled with memcached.

Related

Call to undefined function apcu_add()

I'm currently working on an api which has been developed using Lumen 5.4. I'm trying to run this on my local XAMPP for Linux 7.4.3. But I keep getting the following error,
lumen.ERROR:
Symfony\Component\Debug\Exception\FatalThrowableError:
Call to undefined function xxx\Prometheus\Storage\apcu_add() in
/opt/lampp/htdocs/xxx-api/vendor/xxx/php-prometheus-exporter/src/Storage/APCU.php:78
Current PHP version is 7.4.3. I have installed apcu along with apcu_bc and added the following to php.ini as well,
extension=apc.so
apc.enabled="1"
but I'm not seeing any apc related info in phpinfo.php page.
Any help is appreciated.

showing two different PHP versions in command line

I installed laravel project 5.1 which is working fine but artisan commands are not working throwing each() error which is deprecated in php 7.1. When I run phpinfo() it shows php version 5.6 and on command line there's also two versions are showing
when run
phpinfo();
5.6
when run on command Line in xampp folder
C:/xampp> php -v;
5.7
when run in command in this xammpp/php directory
C:/xampp/php> php -v;
5.6
This is because there are CLI version and WEB version.
How Giacomo1968 says in this answer on Super User:
“Don’t panic! If you are concerned about what PHP version your Apache server is using, the output of phpinfo() is always what you should pay attention to. The Apache PHP module and the PHP command line binary are two different things that don’t interfere with each other.
In fact you can compile and load various PHP versions you want to work with Apache as long as you adjust Apache to properly load it. The PHP command line interface will never come into play in the case of Apache parsing PHP pages.
The command line version of PHP is simply there for command line specific tasks and the PHP module for Apache will never touch, use or need that.”

Class 'DateTimeImmutable' not found

I've just run an update for my CakePHP version (3.1.7). And now I'm unable to run my app, with a fatal error :
Fatal error: Class 'DateTimeImmutable' not found in /opt/lampp/htdocs/my-app/vendor/cakephp/chronos/src/Chronos.php on line 50
I found this issue on Github, where I noticed that
DateTimeImmutable was not present in 5.4
So I install PHP5.6.20 on my PC, but after restarting Xampp, I still get the same error. How can I fix this ?
PHP's installation on the PC is not related to Xampp. So installing PHP doesn't solve the problem. But installing a new version of Xampp with PHP 5.6.
It's a PHP Version Problem make sure You're using PHP > 5.5v

Laravel - artisan command not working

I am getting started with using laravel on Mac and am using MAMP. I am using the `artisan' command with laravel in php.
php artisan migrate:make create_users_table --table=users --create
But it is giving me this error
php artisan migrate:make create_users_table --table=users --create
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so, 9): image not found in Unknown on line 0
Laravel requires the Mcrypt PHP extension.
I have installed the mcrypt extension for PHP.
brew install php53-mcrypt
This gives me a message saying that it is already installed: php53-mcrypt-5.3.26 already installed
PHP being different when run in the command line versus through your web server turns out to be a pretty common issue (note that those are three separate links with possible solutions :D)
The key point is to:
make sure the correct PHP binary (the one used by MAMP) is in your PATH
(less likely) to check to see if your CLI-run php.ini and loaded extensions is different from your web-server (apache)-run PHP (They can be potentially different).
Finally, please consider saving your time and some stress by using Vagrant or another VM provider, which gives you the ability to run a "real" web server on your computer without mucking up your Mac OS install!

"Fatal error: Class 'Memcache' not found" when installing memcached on Windows Server

I am using XAMPP 1.7.0. I have followed these instructions to install memcached and it works fine for Windows 7 but when I have it installed in Windows Server it shows
Fatal error: Class 'Memcache' not found
I have tried many times to do this but am failing.
This question has been solved here: Class 'Memcache' not found & PHP
Your problem is probably that the dll file you used is not working with your PHP version;
This is your solution (I quote from my own answer)
I found the working dll files for PHP 5.4.4
I don't knowhow stable they are but they work for sure. Credits goes
to this link.
http://x32.elijst.nl/php_memcache-5.4-nts-vc9-x86.zip
http://x32.elijst.nl/php_memcache-5.4-vc9-x86.zip
It is the 2.2.5.0 version, I noticed after compiling it (for PHP
5.4.4).
Please note that it is not 2.2.6 but works. I also mirrored them in my
own FTP. Mirror links:
http://mustafabugra.com/resim/php_memcache-5.4-vc9-x86.zip
http://mustafabugra.com/resim/php_memcache-5.4-nts-vc9-x86.zip

Categories