I have memcached 2.2.0 showing up on phpinfo, but I am unable to implement a project that utilizes this extension. I have been getting this Fatal error: Class 'Memcache' not found. I am running php 5.6.10.
I believe the memcached version might not be compatible with the current php version?
Looks like I needed to install the PHP Extension memcache, where the Memcache Class is located. I had thought memcached was the new memcache, but I need both extensions for the data objects and daemon to work together.
Related
When executing the following PHP code:
$m = new MongoClient("mongodb://localhost:27017");
I get the following error:
Fatal error: Class 'MongoClient' not found in (...)
MongoDB extension seems properly installed (I copied php_mongodb.dll to ext folder and updated php.ini).
PHP seems to confirm that the extension is running properly as the following code confirms it is loaded:
echo extension_loaded("mongodb") ? "loaded\n" : "not loaded\n";
Also, phpinfo() shows that mongodb extension has been loaded.
UPDATE: my problem is still not solved.
phpinfo() clearly shows that the driver is loaded:
But I am still receiving the same fatal error.
TL;DR
The class MongoClient is part of the legacy PECL package mongo but not anymore of the up-to-date mongodb package.
And since you have the mongodb extension installed, and not the mongo one, this is why you are getting the error
Fatal error: Class 'MongoClient' not found
On MongoDB PHP driver github repo, the release note about the version 1.0.0, is suggesting developers to use MongoDB\Driver\Manager instead of MongoClient
Changes from our legacy mongo extension
Most significantly, the legacy driver's MongoClient, MongoDB, and
MongoCollection classes have been obsoleted by the
MongoDB\Driver\Manager class, which is the new gateway for connecting
and executing queries, commands, and write operations.
Source:: https://github.com/mongodb/mongo-php-driver/releases/tag/1.0.0
So, here is the replacement class documentation and the snippet of code that should replace yours :
$m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
As the documentation is prompting it, the class is deprecated.
Warning This extension that defines this class is deprecated. Instead,
the MongoDB extension should be used. Alternatives to this class
include:
MongoDB\Driver\Manager
Source: http://php.net/MongoClient
From what I read on their github repository release history, the class you are trying to use have been obsoleted since the version of mongodb 1.0.0, so, on the version 1.6.0 you are, this class is not even part of the dll anymore.
That is confirmed by this issue on their github
derickr commented on Apr 16
MongoClient is a class from the old legacy
driver and is not supposed to be available in this one. The new driver
has \MongoDB\Driver\Manager, and, the accompanying library has
\MongoDB\Client.
You either need to install the old legacy extension (pecl install
mongo) and use PHP 5.x, or update your code to use this new driver's
classes as the old driver is not available for PHP 7. There is an
upgrade guide at
http://mongodb.github.io/mongo-php-library/upgrade-guide/
Source: https://github.com/mongodb/mongo-php-driver/issues/300#issuecomment-210820288
Another way, as suggested by the MongoDB member quoted here above is to use this pecl extension: https://pecl.php.net/package/mongo instead of https://pecl.php.net/package/mongodb but please also notice the warning there stating:
This package has been superseded, but is still maintained for bugs and security fixes.
MongoDB(mongo-php-library) and MongoClient(ext-mongo) are different extensions. MongoClient extension is deprecated. If you want to use MongoClient(ext-mongo) related classes, use a wrapper like this one;
https://github.com/mitsh/mongo-php-adapter
Adapter to provide ext-mongo interface on top of mongo-php-library
You don't need to change anything on your project. Just install and include it with composer.
I have installed Php 7.1.9 on a windows server 2012 machine, if I check the php info I can see that mcrypt is enabled but if I type in shell php -v I have this error:
Unable to load dynamic library 'C:/php/ext\php_mcrypt.dll' - The specified module could not be found.
In fact running a Laravel application I also get some exception related to it.
I have checked ext folder and there is no php_mcrypt.dll .
As you can see here mcrypt is deprecated in favour of OpenSSL. From the Deprecated features in PHP 7.1.x:
The mcrypt extension has been abandonware for nearly a decade now, and was also fairly complex to use. It has therefore been deprecated in favour of OpenSSL, where it will be removed from the core and into PECL in PHP 7.2.
you can use laravel's homestead, it will be a lot easier since it will handle your environment with all the necessary services required by laravel framework.
https://laravel.com/docs/5.5/homestead
I am migrating a Drupal site to another server and keep getting HTTP 500 error in the browser. When I investigate the PHP error log, I see that there is
PHP Fatal error: Call to undefined function sqlsrv_connect()
in one of the files. I am on a Linux environment and have Composer installed. Is there a way to install the mssql extension using the Composer? Alternatively, what is an efficient way to install MSSQL extension?
the SQLSRV functions are only available on Windows machines.
you can try using the ODBC functions, after installing the drivers but you will have to rewrite your code to use them.
if you happen to be running Ubuntu, here's a script for installation.
I have mySQL and PHP 5.5 installed on an AWS EC2 instance. However, when I try
$db = new mysqli($args)
PHP kicks me to the autoloader, as if it can not find the constructor for the mysqli object. I have uncommented extension=mysql.so in the php.ini file, but that does not seem to have accomplished anything. At startup, I get
PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.5/modules/msql.so' - /usr/lib64/php/5.5/modules/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
I thought that mysqli/native driver came prepackaged with PHP5.5, but maybe I was wrong about that. Can someone give me a hint as to how PHP5.5 plays with mysqli?
It doesn't come prepackaged in the case of Amazon Linux. It's an addon module (Assuming you are using Amazon Linux). You can run:
sudo yum install php55-mysqlnd
Maybe misspelled? PHP is trying to load msqli.so, not mysqli.so. Check that you write "extension=mysqli.so", not "extension=msqli.so"
I'm setting up the default instance for a new Amazon Elastic Beanstalk cluster however I'm having issues installing the gearman php client via pecl.
I ran pecl install mongo without any issues, but after I run pecl install gearman it gives the following error:
[root#ip ~]# php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gearman.so' - libgearman.so.8: cannot open shared object file: No such file or directory in Unknown on line 0
I do have gearmand installed, just the php client is giving me trouble. The php module gearman.so is in the "/usr/lib64/php/modules/" folder too.
Anyone have any idea why this might be happening?
Unfortunately gearman is a bit more complicated to install. You will need to download and compile the gearman server even if you don't intend to use your current server for gearman. It provides the library that you are missing.
If you look at the error message its missing libgearman.so.8 not gearman.so