How to configure memcached in suitecrm Version 7.8.2 - memcached

I am running Suitecrm 7.8.2 on XAMPP where PHP version is 7. I want to install Memcached on this. Is there any way to configure the Memcached on suitecrm.
Please Help. Thanks in advance.

If its not already in the config.php file, add the following to the config_override.php file, add the following:
'external_cache' =>
array (
'memcached' =>
array (
'host' => '127.0.0.1',
'port' => '11211',
),
),

Related

Using Jenssegers MongoDB with Slim and Capsule

I am using the Slim 4 framework along with Jenssegers MongoDB library and Capsule (Illuminate\Database from Laravel). I have got the MongoDB extension installed on my Linux server and everything seems ok connection wise, but I cannot seem to insert data into the database or get anything from it. I have tried with the query builder and Eloquent. My code with query builder example is below.
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
$capsule->getDatabaseManager()->extend('mongodb', function($config, $name) {
$config['name'] = $name;
return new \Jenssegers\Mongodb\Connection($config);
});
$capsule->addConnection([
'host' => '127.0.0.1',
'port' => 27017,
'database' => 'testing',
'username' => '',
'password' => '',
], 'mongodb');
// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule->setEventDispatcher(new Dispatcher(new Container));
// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();
$capsule->connection('mongodb')->collection('testing')->insert([
'test1'=>'hello',
'test2'=>'world',
]);
The database and collection exist as I can see them in Compass. Can anyone see where I'm going wrong with the code or is it a configuration issue?
There were two problems, one was the driver missing as you point out, but the other was the fact my PHP is running in Linux using Vagrant and it was pointing to localhost, but the MongoDB server is running on the Windows machine and not Linux. Thanks.

Lumen and MongoDB?

Is it somehow possible to include the mongodb connection settings into a lumen framework. As from what I saw the config/database.php is loaded internally in the lumen package. Is there a way to extend it somehow to include the mongodb connection settings?
We're actually using Lumen, Laravel, Mongo, and MySQL in one giant project so I can help you through this one. Assuming you want to use MongoDB with eloquent instead of with the raw MongoClient. You can find the library I'm using from jenssegers here.
Install MongoDB Extension
Firstly you'll need to install the dependencies for PHP to interact with mongo. The specifics for installing the mongo extension can be found on the PHP documentation.
After that you'll have to edit the php.ini files for the platforms (apache/cli/nginx) to load the extension. I added the following before Module Settings
extension=mongo.so
It goes without saying you need to restart apache/nginx after changing the configuration.
Configuring Lumen
In your root lumen folder you can add it to your requirements with the following command.
composer require jenssegers/mongodb
From there you'll need to also load the MongodbServiceProvider before Facades or Eloquent is initialized.
$app->register(Jenssegers\Mongodb\MongodbServiceProvider::class);
$app->withFacades();
$app->withEloquent();
For simplicity of organizing configuration I also created a config folder and a database.php config file. Since Lumen doesn't try to autoload or search this directory we have to tell it to load this config. I put the following line right before the loading the application routes.
$app->configure('database');
In database.php the mongodb driver requires a specific structure. I've included mysql in here as I use both, but if you're using mongo exclusively you can change default to mongodb and remove the mysql config.
return [
'default' => 'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', ''),
'username' => env('DB_USERNAME', ''),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'mongodb' => array(
'driver' => 'mongodb',
'host' => env('MONGODB_HOST', 'localhost'),
'port' => env('MONGODB_PORT', 27017),
'username' => env('MONGODB_USERNAME', ''),
'password' => env('MONGODB_PASSWORD', ''),
'database' => env('MONGODB_DATABASE', ''),
'options' => array(
'db' => env('MONGODB_AUTHDATABASE', '') //Sets the auth DB
)
),
],
];
With the configuration out of the way you can now create a model, as of writing this to create a model for mongo (check the github page) you can use the following as a base. You can ignore the $connection variable if mongo is your default driver.
<?php
namespace App;
use Jenssegers\Mongodb\Model as Eloquent;
class Example extends Eloquent
{
protected $connection = 'mongodb';
protected $collection = 'example';
protected $primaryKey = '_id';
}
There you go, you should be able to interact with mongo normally, for the specifics of the driver check out the github page for documentation on it.
If this answer helped you could you mark it as the answer?
2016 (Update)
There is now a simple Doctrine MongoDB ODM Provider for the Lumen PHP framework.
composer require nordsoftware/lumen-doctrine-mongodb-odm
GitHub Source Code
Warning
jenssegers/mongodb is a Driver sitting on top of Illumante's Eloquent ORM.
Think of it: Eloquent ORM is primary made for SQL. And let's cut with the chase: The package is the reinvention of the wheel - as a side effect, major mongodb features are not supported. Besides that, the package is unstable and unmaintained.
Be aware, jenssegers/mongodb will vent your anger and frustration:
Just a change in #Sieabah user:
instead: extension=mongo.so
choose: extension=mongodb.so

zend framework Connect Error: could not find driver pdo mysql

I have a machine with:
centOS 6.5
php 5.5.7 from remi repository
mysql 5.5.35 from remi repository
i'm triyng to connect zend framework 2 to a mysql database but i getting the following error:
An error occurred
An error occurred during execution; please try again later.
Additional information:
Zend\Db\Adapter\Exception\RuntimeException
File:
/var/www/zf2demo/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Connection.php:289
Message:
Connect Error: could not find driver
According to phpinfo i have the pdo installed and running
PDO support enabled
PDO drivers mysql, sqlite
pdo_mysql
PDO Driver for MySQL enabled
Client API version mysqlnd 5.0.11-dev - 20120503 - $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $
Directive Local Value Master Value
pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock
I already have the extensions pdo.so and pdo_mysql.so in my php.ini file.
my connection is done by (the username and password are at other file):
return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=album;host=localhost',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
);
What can be wrong?
I had the similar problem at CentOS release 6.4 with Zend and PHP 5.4. PDO appears in phpinfo() but mentioned error ("could not find driver") ocurred on all pages related with database. Php 5.4 had included packages php-common, etc. and previous pdo package was obtained from alterantive yum/rpm repository. Maybe your current PDO package also fails.
Finally, in my case the solution was to install other php-pdo package (php54w-pdo.x86_64).
#yum install php54w-pdo.x86_64
I supose that you should install php55w-pdo.x86_64
#yum install php55w-pdo.x86_64
Don't forget restart Apache!

Cakephp 2.0 Mongodb Plugin not loading

I am trying to change my database over to Mongodb. I have Mongo loaded and working from the shell. Now I am trying to get cakephp 2.0 to connect to the database. I have downloaded and installed ichiaway's drive into the app/plugin directory as Mongodb. I have included the line
CakePlugin::load('Mongodb');
in my bootstrap.php file. I have changed my database.php file to
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'mongodb.mongodbSource',
'host' => 'localhost',
'database' => 'service4u',
'port' => 27017
);
The database works as a service right now and I can start the mongo shell and work with the database just fine but when I try and load a page from my app I get the following error.
Missing Plugin
Error: The application is trying to load a file from the mongodb plugin
Error: Make sure your plugin mongodb is in the app\Plugin directory and was loaded
<?php
CakePlugin::load('mongodb');
Loading all plugins: If you wish to load all plugins at once, use the following line in your app\Config\bootstrap.php file
CakePlugin::loadAll();
I am at a loss now on what to do. I have tried putting the files in different folders inside the Mongodb folder in the plugin folder but nothing I do helps. Any insight would be helpful. Thanks.
Was able to find the answer. The only thing I had wrong was in my database.php file the datasource should be camelCase. I had lowercase m's, changed them to M and it worked.
Found the answer here
CakePHP 2 can not find plugin
Make sure downlaod file more then 2.5.if not please
Download mongoDB plugin for cake php.
just download and put he all file on app/plugin/Mongodb.
set database in database.php
public $default = array(
'datasource' => 'Mongodb.MongodbSource',
'host' => 'localhost',
'database' => 'blog',
'port' => 27017,
'prefix' => '',
'persistent' => 'true',
);
public $test = array(
'datasource' => 'Mongodb.MongodbSource',
'database' => 'test_mongo',
'host' => 'localhost',
'port' => 27017,
);
and add blow code on bootstrap.php
CakePlugin::load('Mongodb');

Not able to connect PostgreSQL with Yii

I have tried to connect PostgreSQL with Yii but is is showing
CDbConnection failed to open the DB connection.
In log it is showing
error exception.CDbException
could not find driver
My code
'db'=>array(
'tablePrefix'=>'',
'connectionString' => 'pgsql:host=localhost;port=5432;dbname=postgres',
'username'=>'postgres',
'password'=>'postgres',
'charset'=>'UTF8',
),
Yii Database component is build on top of PHP PDO. So Here are list of posibilities to check
Check that PostgreSQL and PostgreSQL's PDO Extension is installed and working. Also that port is right one. You can test simple PHP Script to test.
Below are links to something that might be similar
PostgreSql 'PDOException' with message 'could not find driver'
PDOException “could not find driver”
Install PDO on Linux (Ubuntu/Debian)
Install pdo for postgres Ubuntu
https://serverfault.com/questions/89970/how-to-install-postgresql-extension-for-pdo-in-linux
Windows
http://blog.lysender.com/2010/08/php-and-postgresql-on-windows/
Apache php 5.3 postgreSQL driver could not be loaded
Official PHP Information on Issue
http://php.net/manual/en/pdo.installation.php
http://www.php.net/manual/en/ref.pdo-pgsql.php
Resolved issue...by adding
LoadFile "C:/wamp/bin/php/php5.3.5/libpq.dll"
to httpd.conf file. Now phpinfo() is showing pgsql PDO.
thanks...
if you work in ubuntu make sure that you have installed pgsql library
sudo apt-get install php-pgsql
sudo service apache2 restart
after make sure that in the console and main-local there are this array
'components' => [
'log' => [
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;port=5432;dbname=yourdb',
'username' => 'user',
'password' => 'pw',
'charset' => 'utf8',
],],
In my case, it was a case of enabling the php_pdo_pgsql extension in WAMP
for those struggling with the same issue i did the work around.
environment
Yii2
server:LAMP stack 7.1
problem Driver not found i.e the "requirements.php" shows warning
"PDO PostgreSQL extension Warning All DB-related classes Required for PostgreSQL database."
i noted that pdo_pgsql.so is not packaged together with bitnami so i search for it online or try locate if installed on any php versions in /usr/lib/php
copy that file to lampstack-7.1.10-1/php/lib/php/extensions.
now go to lampstack php.ini "lampstack-7.1.10-1/php/etc/php.ini"
now place this line "extension=pdo_pgsql.so" remove ; if commented out NB you can point to the absolute path "/usr/lib/php/pdo_pgsql.so" if it existed there
restart Lamp apache server
visit requirement.php and if you see ""PDO PostgreSQL extension Passed All DB-related classes Required for PostgreSQL database.""