Production Environment Issue

Hi,

I created a basic site that allow authenticated users to upload files onto the database. It works perfectly on my local wamp environment but when I uploaded the files to production (bluehost.com) I get the following error mesg. Does anyone know why this occurs? Is there a setting I am missing?

Thanks!

CDbException

Description

The table "Report" for active record class "Report" cannot be found in the database.

Source File

/home2/techsavv/public_html/staging/yii/framework/db/ar/CActiveRecord.php(2154)

02142: private $_validators;

02143:

02144: /**

02145: * Constructor.

02146: * @param CActiveRecord the model instance

02147: */

02148: public function __construct($model)

02149: {

02150: $this->_model=$model;

02151:

02152: $tableName=$model->tableName();

02153: if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)

02154: throw new CDbException(Yii::t(‘yii’,‘The table “{table}” for active record class “{class}” cannot be found in the database.’,

02155: array(’{class}’=>get_class($model),’{table}’=>$tableName)));

02156: if($table->primaryKey===null)

02157: $table->primaryKey=$model->primaryKey();

02158: $this->tableSchema=$table;

02159: $this->columns=$table->columns;

02160:

02161: foreach($table->columns as $name=>$column)

02162: {

02163: if(!$column->isPrimaryKey && $column->defaultValue!==null)

02164: $this->attributeDefaults[$name]=$column->defaultValue;

02165: }

02166:

Have you updated main.php to reflect the db environment on your host as opposed to your local dev environment, and with the right credentials?

Also, did you create those databases and tables on the host?

The database and tables have been created.

I was also successful in using basic php/mysql (not using yii) to retrieve data from the table.

I wonder if it might be an issues with the php.ini settings. My local environment has these settings:

;extension=php_bz2.dll

;extension=php_curl.dll

;extension=php_dba.dll

;extension=php_dbase.dll

;extension=php_exif.dll

;extension=php_fdf.dll

extension=php_gd2.dll

;extension=php_gettext.dll

;extension=php_gmp.dll

;extension=php_ifx.dll

;extension=php_imap.dll

;extension=php_interbase.dll

;extension=php_ldap.dll

extension=php_mbstring.dll

;extension=php_mcrypt.dll

;extension=php_mhash.dll

;extension=php_mime_magic.dll

;extension=php_ming.dll

;extension=php_msql.dll

;extension=php_mssql.dll

extension=php_mysql.dll

extension=php_mysqli.dll

;extension=php_oci8.dll

;extension=php_openssl.dll

extension=php_pdo.dll

;extension=php_pdo_firebird.dll

;extension=php_pdo_mssql.dll

extension=php_pdo_mysql.dll

;extension=php_pdo_oci.dll

;extension=php_pdo_oci8.dll

;extension=php_pdo_odbc.dll

;extension=php_pdo_pgsql.dll

;extension=php_pdo_sqlite.dll

;extension=php_pgsql.dll

;extension=php_pspell.dll

;extension=php_shmop.dll

;extension=php_snmp.dll

;extension=php_soap.dll

;extension=php_sockets.dll

extension=php_sqlite.dll

;extension=php_sybase_ct.dll

;extension=php_tidy.dll

;extension=php_xmlrpc.dll

extension=php_xsl.dll

;extension=php_zip.dll

but when I try to configure the production php.ini I see the following mesg:

;Windows Extensions

;Note that MySQL and ODBC support is now built in, so no dll is needed for it.

What about the Yii DB config in protected/config/main.php?

Is the ‘Report’ table the only one you have at the moment? If not, can your app access other tables?

It looks like Yii can’t access the database and thus can’t find the table, so checking main.php to see if the database config is correct is worth checking out :)

The php.ini is probably ok or Yii would throw different exceptions, I believe, so everything is working as it should until it tries to access the table.

main.php was actually the first place I checked, all the info should be in order unless I have a syntax error

‘db’=>array(

	    'class'=>'CDbConnection',


	    'connectionString'=>'mysql:host=localhost;dbname=techsavv', 


	    'username'=>'admin',


	    'password'=>'HomePage24',


	),

then using the same credentials I created a test page to access the database and table. There’s only one table in the database so, I’m not sure if it’s only have trouble with that one table or just the database in general. You have a good point. I’ll try to add another table to see if that one is accessible.

Thanks!

Another clue might be case sensitivity. Is the "Report" table with a capital "r"?

I didn’t realize the table names were case-sensitive. The table name is currently lower case. Does it need to be upper case?

Hey!

Just want to send out an update.

After updating the table name to start with uppercase, I am now able to connect. Oddly enough, all this time that I was developing locally, my table name was entirely lowercase but worked fine.

Anyhow, thank you all for your help!

Is your development environment Windows? IIRC, case sensitivity of table (and some other) names works differently under Windows and Linux. IIRC, this is an attempt to deal with a more general case sensitivity brokenness under Windows.

I just got the same problem! thank you for your question same as mine.

I notice that in my case, the mysql engine for each table was changed to myisam instead of innodb. I read the mysql manual and it says something like innodb is case-insensitive. I tried to change, in production system, from innodb to myisam but no success. I don’t know why. Finally, I just change the table name to what ever the error code says and it works.

thanks very much