View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
06259Bug reportsInstallationpublic2012-07-26 21:52
ReporterTMSWhite Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00RC4 
Fixed in Version2.00RC7 
Summary06259: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist
Description

Occurs when get to "Database settings" step of fresh install

Additional Information

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist in C:\xampp\htdocs\ls2\framework\db\CDbCommand.php on line 497 Call Stack #TimeMemoryFunctionLocation 10.0012355224{main}( )..\index.php:0 20.02942021360CApplication->run( )..\index.php:171 30.02942021360CWebApplication->processRequest( )..\CApplication.php:162 40.03052021488CWebApplication->runController( )..\CWebApplication.php:135 50.04052790456InstallerController->run( )..\CWebApplication.php:276 60.05494926912InstallerController->stepDatabaseConfiguration( )..\InstallerController.php:70 70.13856653144CDbCommand->queryAll( )..\InstallerController.php:296 80.13856653520CDbCommand->queryInternal( )..\CDbCommand.php:390 90.13876655128PDOStatement->execute( )..\CDbCommand.php:497 ( ! ) CDbException: CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist. The SQL statement executed was: SELECT * FROM lime_surveys in C:\xampp\htdocs\ls2\framework\db\CDbCommand.php on line 528 Call Stack #TimeMemoryFunctionLocation 10.0012355224{main}( )..\index.php:0 20.02942021360CApplication->run( )..\index.php:171 30.02942021360CWebApplication->processRequest( )..\CApplication.php:162 40.03052021488CWebApplication->runController( )..\CWebApplication.php:135 50.04052790456InstallerController->run( )..\CWebApplication.php:276 60.05494926912InstallerController->stepDatabaseConfiguration( )..\InstallerController.php:70 70.13856653144CDbCommand->queryAll( )..\InstallerController.php:296 80.13856653520CDbCommand->queryInternal( )..\CDbCommand.php:390

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)120624
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql 5.3
Server OS (if known)Windows XP
Webserver software & version (if known)XAMPP
PHP Version5.3

Relationships

related to 06263 closedc_schmitz unable to browse responses 
related to 06162 closedc_schmitz unable to list surveys 

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2012-06-22 23:26

administrator   ~19494

I am sorry. I can't reproduce this here. Looks like for some reason the tables in your database are not created? Can you check?

TMSWhite

TMSWhite

2012-06-24 03:22

reporter   ~19534

This happens before the tables are created. When I do the install, I create the database first (since users don't have create database permissions). This error occurs at the step that says "the database exists - do you want to populate it?"

c_schmitz

c_schmitz

2012-07-06 10:08

administrator   ~19636

Last edited: 2012-07-06 10:09

Sorry, I cannot reproduce. Works just fine. I assume something is terribly off with your system considering the other bugs you reported, too. Nobody else reported this issue, either.

So unless you debug yourself or come up with some new info regarding this I will have to close this issue because it is not reproducable for me.

TMSWhite

TMSWhite

2012-07-07 22:44

reporter   ~19676

I just did a clean checkout from Git and a clean install, and I get the same error.

The problem may be in Yii.

The error is generated by lines 518-530 of CDbCommand.php:

catch(Exception $e)
{
    if($this->_connection->enableProfiling)
        Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
    $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
    $message = $e->getMessage();
    Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
        array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
    if(YII_DEBUG)
        $message .= '. The SQL statement executed was: '.$this->getText().$par;
    throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
        array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
}

Which is called by lines 293-301 of InstallerController.php:

// Check if the surveys table exists or not
if ($bDBExists == true) {
    try {
         $this->connection->createCommand()->select()->from('{{surveys}}')->queryAll();
         $bTablesDoNotExist = false;
    } catch(Exception $e) {
         $bTablesDoNotExist = true;
    }
}

So, even though the try/catch clause detects that the tables do not exist, the Yii::log() sub-system writes the log to the screen.

Is that something we can control?

c_schmitz

c_schmitz

2012-07-18 13:46

administrator   ~19750

The try/catch should catch it, and it does that here just fine, so I am still wondering why it doesn't do that on your system?

I have

display_errors = On
and
error_reporting = E_ALL

set in php.ini. I still guess it is some configuration issue on your server.

TMSWhite

TMSWhite

2012-07-18 15:11

reporter   ~19756

try/catch does catch it; however, CDbCommand's try/catch grabs it first and adds it to the logging system. So, although InstallerController's try/catch works fine, Yii::log() still shows it to the screen, and thus breaks the JSON response used for listing surveys.

I spent a while looking, but couldn't find an easy way to turn off the Yii logging system or get it to write to disk. I'm sure there is a way, but it wasn't obvious.

c_schmitz

c_schmitz

2012-07-18 16:13

administrator   ~19768

See http://www.yiiframework.com/doc/guide/1.1/en/topics.logging

c_schmitz

c_schmitz

2012-07-24 20:21

administrator   ~19951

Anything?

TMSWhite

TMSWhite

2012-07-24 20:38

reporter   ~19953

I spent a little while trying to figure out the logging, but it wasn't very intuitive.

Without logging customizations (e.g. with the default configuration), I still get the same error. This one I can live with, but this is also the root problem for 06162 - I still can't list surveys in 2.0 despite multiple fresh re-installs of LS 2.0

If this starts to affect other people, I'd recommend adding in default logging that fixes this specific problem.

c_schmitz

c_schmitz

2012-07-26 08:47

administrator   ~19969

Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=9133

c_schmitz

c_schmitz

2012-07-26 08:49

administrator   ~19970

Last edited: 2012-07-26 11:10

TMSWHite: Please check if it is working now. By default the YII debug mode is now deactivated. You can simply activate it for dev purposes by setting the debug param in config.php after installation or whenever it suits you.

TMSWhite

TMSWhite

2012-07-26 16:55

reporter   ~19989

Now I get a new set of errors when I do a fresh install (see attached screen shots). I double checked my php.ini file, and it does not have any debugging turned on.

c_schmitz

c_schmitz

2012-07-26 18:04

administrator   ~19990

Fix committed to Yii branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=9146

c_schmitz

c_schmitz

2012-07-26 18:04

administrator   ~19991

Try again now, please.

TMSWhite

TMSWhite

2012-07-26 18:20

reporter   ~19992

OK, that fixes the config.php errors, but I still get the original error from the database step - see newest screenshot

c_schmitz

c_schmitz

2012-07-26 19:38

administrator   ~19993

Last edited: 2012-07-26 19:39

Can you check (if necessary by inserting the code in the framework) what value the YII_DEBUG constant has when the error is thrown?
if it is false, then it is weird why still an error is thrown, if it is true then the question is where it is set to true.

c_schmitz

c_schmitz

2012-07-26 19:44

administrator   ~19994

From what I can see is that an exception is caugth by the framework, which then throws another exception, which then should be caught by the try/catch
in lines 293-301 of InstallerController.php. Only on your system the last step does not happen. Maybe a bug in your PHP version? Which 5.3 version are you using exactly?

TMSWhite

TMSWhite

2012-07-26 20:50

reporter   ~19995

Lines 293-301 do catch the error, and the value of YII_DEBUG is false when that error is caught.

The problem stems from lines 350-356 and 518-530 of CDbCommand.php, specifically:

Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.', array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');

Oddly, however, if I surround the Yii::log() blocks with if (YII_DEBUG) { }, they are never called, yet I still see the log message.

Hmm, actually, is this line (528) in the CDbCommand.php that is the problem:

throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}', ('{error}'=>$message)),(int)$e->getCode(),$errorInfo);

Although that exception is caught, somehow it generates a log message anyway.

I am using PHP Version 5.3.5

TMSWhite

TMSWhite

2012-07-26 21:43

reporter   ~19996

Perhaps it is a version issue.

I just installed XAMPP 1.8.0, which uses PHP 5.4.4, and everything now works fine.

Wierd. If it is a PHP 5.3 issue (or a 5.3.5 issue), it would be nice to caution users (and/or let them know that an upgrade can fix it). I don't have time to test other PHP 5.3 versions, so perhaps others can report which 5.3 versions are known to work properly with LS 2.0

c_schmitz

c_schmitz

2012-07-26 21:49

administrator   ~19997

This one comes close: https://bugs.php.net/bug.php?id=52890

It's not exactly clear in what version this was finally fixed. It might also be a later silent fix-fix.

Anyway, if someone comes around with this kind of bug we know where it comes from so at least something good came out of this.
If you don't mind lets close this issue then.

TMSWhite

TMSWhite

2012-07-26 21:52

reporter   ~19998

Fixed by PHP version upgrade

Related Changesets

LimeSurvey: Yii cca7b1f4

2012-07-25 23:47:23

c_schmitz

Details Diff
Fixed issue 06259: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist
Dev Please note that developers have to manually set debug paramter to 1 or 2 in config.php now to see all errors
Affected Issues
06259
mod - application/controllers/InstallerController.php Diff File
mod - application/core/LSYii_Controller.php Diff File
mod - index.php Diff File

LimeSurvey: Yii a6b43b46

2012-07-25 23:59:25

c_schmitz

Details Diff
Fixed issue 06259: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist
Dev Please note that developers have to manually set debug paramter to 1 or 2 in config.php now to see all errors
Affected Issues
06259
mod - application/core/LSYii_Controller.php Diff File
mod - index.php Diff File

LimeSurvey: Yii be5fced4

2012-07-26 09:04:37

c_schmitz

Details Diff
Fixed issue 06259: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ls2.lime_surveys' doesn't exist Affected Issues
06259
mod - index.php Diff File

Issue History

Date Modified Username Field Change
2012-06-22 21:54 TMSWhite New Issue
2012-06-22 23:26 c_schmitz Note Added: 19494
2012-06-22 23:26 c_schmitz Assigned To => c_schmitz
2012-06-22 23:26 c_schmitz Status new => feedback
2012-06-24 03:22 TMSWhite Note Added: 19534
2012-06-24 03:22 TMSWhite Status feedback => assigned
2012-07-06 10:08 c_schmitz Note Added: 19636
2012-07-06 10:09 c_schmitz Note Edited: 19636
2012-07-06 10:09 c_schmitz Status assigned => feedback
2012-07-07 22:44 TMSWhite Note Added: 19676
2012-07-07 22:44 TMSWhite Status feedback => assigned
2012-07-07 23:13 TMSWhite Relationship added related to 06263
2012-07-07 23:14 TMSWhite Relationship added related to 06162
2012-07-18 13:46 c_schmitz Note Added: 19750
2012-07-18 13:46 c_schmitz Status assigned => feedback
2012-07-18 15:11 TMSWhite Note Added: 19756
2012-07-18 15:11 TMSWhite Status feedback => assigned
2012-07-18 16:13 c_schmitz Note Added: 19768
2012-07-18 16:13 c_schmitz Status assigned => feedback
2012-07-24 20:21 c_schmitz Note Added: 19951
2012-07-24 20:38 TMSWhite Note Added: 19953
2012-07-24 20:38 TMSWhite Status feedback => assigned
2012-07-26 08:47 c_schmitz Changeset attached => LimeSurvey Yii cca7b1f4
2012-07-26 08:47 c_schmitz Note Added: 19969
2012-07-26 08:47 c_schmitz Resolution open => fixed
2012-07-26 08:49 c_schmitz Note Added: 19970
2012-07-26 08:49 c_schmitz Status assigned => feedback
2012-07-26 08:59 c_schmitz Changeset attached => LimeSurvey Yii a6b43b46
2012-07-26 11:10 c_schmitz Note Edited: 19970
2012-07-26 16:55 TMSWhite Note Added: 19989
2012-07-26 16:55 TMSWhite Status feedback => assigned
2012-07-26 16:55 TMSWhite File Added: ls2rc7-install-error-1.jpg
2012-07-26 16:56 TMSWhite File Added: ls2rc7-install-error-2.jpg
2012-07-26 16:56 TMSWhite File Added: ls2rc7-install-error-3.jpg
2012-07-26 16:56 TMSWhite File Added: ls2rc7-install-error-4.jpg
2012-07-26 18:04 c_schmitz Changeset attached => LimeSurvey Yii be5fced4
2012-07-26 18:04 c_schmitz Note Added: 19990
2012-07-26 18:04 c_schmitz Note Added: 19991
2012-07-26 18:05 c_schmitz Status assigned => feedback
2012-07-26 18:20 TMSWhite Note Added: 19992
2012-07-26 18:20 TMSWhite Status feedback => assigned
2012-07-26 18:20 TMSWhite File Added: ls2rc7-install-error-5.jpg
2012-07-26 19:38 c_schmitz Note Added: 19993
2012-07-26 19:39 c_schmitz Note Edited: 19993
2012-07-26 19:44 c_schmitz Note Added: 19994
2012-07-26 20:50 TMSWhite Note Added: 19995
2012-07-26 21:43 TMSWhite Note Added: 19996
2012-07-26 21:49 c_schmitz Note Added: 19997
2012-07-26 21:52 TMSWhite Note Added: 19998
2012-07-26 21:52 TMSWhite Status assigned => closed
2012-07-26 21:52 TMSWhite Fixed in Version => 2.00RC7