LimeSurvey on drupal fatal error - php

I'm currently building a site on drupal with the lime survey module. I tried configuring the synchronization between the limesurvey and my site.
I opened sites/default/settings.php, and added the lines below after the $databases['default']['default'] variable :
$databases['ls']['default'] = array(
'driver' => 'your_LimeSurvey_driver',
'database' => 'your_LimeSurvey_database_name',
'username' => 'your_LimeSurvey_database_username',
'password' => 'your_LimeSurvey_database_user_password',
'host' => 'your_LimeSurvey_host'
'prefix' => 'lime_' [or another value]
'collation' => 'utf8_general_ci' [or another value]
);
as instructed.
I first encountered this error( Parse error: syntax error, unexpected ''prefix'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in C:\wamp\www\lime survey\drupal-7.24\sites\default\settings.php on line 235 ) and solved it by taking the '[or another value]' out of the code.
I'm now facing these errors (http://postimg.org/image/b6ynerdr1/) (http://postimg.org/image/io7utz3a5/) and i have run out of ideas. Please help me out

"your_LimeSurvey_driver" shouldn't be a literal value. You should change this to either 'mysql', 'pgsql' or 'sqlite' depending on the type of database you are using. It will probably be 'mysql'.
Similarly you should change 'your_LimeSurvey_database_name' etc to be actual names, usernames and passwords for the database, and 'your_LimeSurvey_host' should be the host the database is running on - likely to be 'localhost' or '127.0.0.1' depending on your setup.

Related

Class 'Swoole\MySQL' not found

Async Mysql Client of Swoole in my PHP Project for which I am trying to use Swoole MySQL Class of PHP but I am getting
class not found
error while executing the code.
Below is the code snippet I was trying to execute:
<?php
use Swoole\MySQL as MySQL;
MySQL::connect(array(
'host' => 'localhost',
'port' => '3306',
'user' => 'root',
'password' => 'Secret_Password',
'database' => 'swoole_test_db',
'charset' => 'utf8',
'timeout' => 2,
), function ($mysql_client) {
$mysql_client->query("SELECT `reg_id`, `name` FROM `students` WHERE `reg_id` = 8;", function ($result) {
var_dump($result);
});
});
I tried searching everywhere but unable to find any reference on this error.
Version Details
PHP 7.3.2
Swoole Version 4.4.3 (with Swoole MySQL selected Yes during installation)
Did I miss something, please help?
Thanks in advance!!!
It seems that the official documentation is either a bit off, or mentions a previous version of Swoole.
The class that should be used is Swoole\Coroutine\MySQL.
You can verify that using the official documentation in their GitHub repository.

trying to load tables into my database using vagrant

I'm using Vagrant to start a VirtualBox VM in windows. I do:
$ vagrant ssh
To connect to the VM. Then I do $ mysql to connect to my database. Then I can see my DB that I have created to use. However When I go to my server I see this error:
The table "doe_user" for active record class "User" cannot be found in the database.
I know thats because the database is empty and the table User doesnt exist. thats why I tried to added tables to database using this :
load all tables in the doe_db: http://***.***.**.**/install.php;
When I run this, i get:
mysql> load all tables in the doe_db: http://***.***.**.**/install.php;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'all t
ables in the doe_db: http://***.***.**.**/install.php' at line 1,
when I use show databases then I select the correct database, then asking to show the tables it returns empty set.
when I go to my http://***.***.**.**/install.php I get:
Internal Server Error
Undefined index: log
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.
Thank you.
Here is my database code:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
Now when I visit: http://***.***.**.**/index.php
I get the error:
The table "doe_user" for active record class "User" cannot be found in
the database.
However when I change my databse code to:
$config_database = array(
'components' => array(
'db' => array(
'connectionString' => 'mysql:host=localhost;dbname=doe_db',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'enableProfiling' => true, //http://www.yiiframework.com/doc/guide/1.1/en/topics.logging
'enableParamLogging' => true,
),
),
);
And when I visit: http://***.***.**.**/index.phpI get:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
for my local host, when I want to access phpMyAdmin, I dont have any password for my root user.
You can refer MySQL - LOAD DATA INFILE to load the data from a file.
LOAD DATA INFILE 'http://***.***.**.**/install.php' INTO TABLE doe_db;

Drupal 7 - MySQL Syntax Error - After amending settings.php

I have 2 sites on the same domain (example.com, site2.example.com) and I am trying to make them both reference the same user tables etc from the main site (example.com) in order to have single sign on through both.
I have 2 DBs set up - one for each - and have set up a user which can access both with all the required permissions. I have altered my settings.php in the second site as below (and numerous variations of):
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => 'database_site2',
'username' => 'multi_username',
'password' => 'multi_password',
'host' => 'localhost',
'prefix' => array(
'default' => 'database_site2.',
'users' => 'database_main_site.',
'sessions' => 'database_main_site.',
'role' => 'database_main_site.',
'authmap' => 'database_main_site.',
),
);
Unfortunately when then trying to access site2 after making this change, I get the following error message:
Uncaught exception thrown in shutdown function.
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in >your SQL syntax; check the manual that corresponds to your MySQL server version for the >right syntax to use near '-amalga-01.semaphore WHERE (value = >'1471293032527ac89955a330.73110726')' at line 1: DELETE FROM {semaphore} >WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => >1471293032527ac89955a330.73110726 ) in lock_release_all() (line 269 of >/home/sites/amalgamart.co.uk/public_html/exampletown/includes/lock.inc).
If someone is able to help me with this I would be forever grateful!
Thanks!
The "prefix" part of Drupal's db configuration refers to a string that is prepended to the table name within a single database, whereas you are trying to use two different databases. I don't think that this is possible in Drupal. Please read this, or you can try and see if Domain Access module could be suitable to your needs.

system.db.CDbConnection taking more than 1 second to execute in yii

I am a new to yii although i have worked a lot with codeigniter and was just trying to convert my code from codeigniter to yii
But the CDbconnection is taking more than 1 second to execute i have attached a screenshot.
also the sql code i am using.
$criteria = new CDbCriteria();
$criteria->select = "total_photos";
$data = array( 'Gallerys' => Gallerynames::model()->findAll($criteria));
Please look into it
Edit:
Here is my db config
'db'=>array(
'class' => 'system.db.CDbConnection',
'connectionString' => 'mysql:host=localhost;dbname=yiiwiki',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'enableProfiling' => true,
'schemaCachingDuration' => 3600,
),
From yii guide
Because ActiveRecord relies on the metadata about tables to determine
the column information, it takes time to read the metadata and analyze
it. This may not be a problem during development stage, but for an
application running in production mode, it is a total waste of time if
the database schema does not change.
so set the schemaCachingDuration of the db application component a value greater than zero.
'db'=>array(
'class'=>'system.db.CDbConnection',
'connectionString'=>'sqlite:/wwwroot/blog/protected/data/blog.db',
'schemaCachingDuration'=>3600,
),
Keep in mind that you should specify a valid cache in the application config
EDIT
It seems your problem is not due to the schema. Refering to this changing localhost to 127.0.0.1 will fix it

MySQL connection in CakePHP -> Why do I keep getting the 30 seconds exceeded fatal error?

Here is a snippet of the code I got from some tutorial blog:
<?php
class PersonalBlogController extends AppController {
var $name = 'PersonalBlog';
var $uses = array('PersonalBlog');
function index(){
//ini_set('max_execution_time', 300);
debug($this->PersonalBlog->findAll());
//debug($this->PersonalBlog->find('all'));
}
}?>
I have seen some other cases in max time limit fatal error from other posts. But mine is probably the most disgusting. The fatal 30 secs time limit error keeps coming even after I change the max_execution_time variable in php.ini. Even after changing it to 60 or 300 seconds, the error message stays the same. It says 30 seconds time limit is exceeded.
I then followed alternative solution from a similar question, which is to do this instead:ini_set('max_execution_time', 300); (See my commented code above).
The error is gone. However what happens after that is this:
Warning (2): PDO::__construct(): [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) [CORE\cake\libs\model\datasources\dbo\dbo_mysql.php, line 155]
.....
.....blablabla...
Fatal error: Call to a member function getAttribute() on a non-object in C:\Server\www\myserver.dev\public_html\cakephp-cakephp-7fbf7a4\cake\libs\model\datasources\dbo\dbo_mysql.php on line 259
So I realized that I actually have two MySQL server installed. The newest one (5.5.11) is on port 3307 not on port 3306! That is why I then changed my driver setting in the dbo_mysql.php:
/**
* Base configuration settings for MySQL driver
*
* #var array
*/
protected $_baseConfig = array(
'persistent' => true,
'host' => 'localhost',
'login' => 'root',
'password' => 'mysqlpassword',
'database' => 'personal_blog',
'port' => '3307'
);
Every other setting is normal; I have the same database setting for app>config>database file as you can see here:
public $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'mysqlpassword',
'database' => 'personal_blog',
'port' => 3307,
'prefix' => '',
);
After those changes, the warning still appears...I really feel like I want to throw up right now
Any help would be appreciated.thx
You shouldn't have to edit the dbo_config to manage the port setting. All of those keys are available for use in the database.php file in your app/config/ folder.
You actually shouldn't have your personal defaults in the dbo file at all -- nothing you are doing should ever edit any core files.
Once you have your port setting in ONLY the database.php file and your dbo driver is back to the one that shipped with cake you should delete all of the files in /tmp/cache and set your debug > 0 in app/config/core.php
Refresh and if the error is still occurring we know that something is messed up at the php.ini / .htaccess or ini_set level. Try adjusting the value and then loading a view that contains
<?php
phpinfo( );
?>
and see if the max execution time setting is actually being read by the php interpreter. If it isn't you might want to try the ini set method or htaccess methods of playing with that value. Also make sure the php.ini you are editing is the right one ( the path to the ini should be in the php info dump ) - you might find you have 2 versions of php loaded as well as your two versions of mysql.
If that doesn't solve or at least pinpoint the issue then post back here and let us know.

Categories