Moving Site to New Server ~ Error

OK some progress.

In the <root>/demos/blog/index.php I simply added a slash/ at the start of the $yii

$yii=dirname(FILE).’/../../protected/framework/yii.php’;

$config=dirname(FILE).’/protected/config/main.php’;

Once i did that, i could now access <root>/demos/blog/index.php however an error appeared:

include(Controllers.php): failed to open stream: No such file or directory.

I did a search and found this: http://www.yiiframework.com/forum/index.php/topic/51257-includecontrollersphp-failed-to-open-stream-no-such-file-or-directory/

Post #5 says:

if you are use specific Controller in your module add also the ‘application.modules.invmgvt.components.*’,

I added this and now the <root>/demos/blog/index.php WORKS!

OK now to the main site.

I have gone into <root>/index.php and removed the slash/ at the start of the two config references:

$configLocal = include dirname(FILE) . ‘protected/config/main.php’;

$configServer = $env==‘local’ ? array() : include dirname(FILE) . ‘protected/config/’.$env.’.main.php’;

I similarly tried adding the absolute url

$configLocal = include dirname(FILE) . ‘http://www.mysite.org/protected/config/main.php’;

$configServer = $env==‘local’ ? array() : include dirname(FILE) . ‘http://www.mysite.org/protected/config/’.$env.’.main.php’;

Now i no longer receive the 500 error, but instead get the error:

I tried adding the same line - ‘application.modules.invmgvt.components.*’, - to the <root>/protected/config/main.php

but that has not fixed it.

Any help is appreciated on this.

What you found searching the forum is not relevant for the blog demo:

application.modules.invmgvt.components.*

is for a customization (module) added by a specific user

Main site: By now you should be able to understand the start script minimum requirements and how to modify the references to config and framework.

Your script obtains the servers domain and checks if it’s <mysite.org>. Obviously it isn’t, so it will use the local config (only) in your case.

You probably should try with a simplified start script pointing to a good config.

You’ll have to check what’s in

<webroot>/protected/config/main.php (local config)

and (something like)

<webroot>/protected/config/<mysite.org>.main.php (server config)

Check what’s in both files since they are merged together in the <mysite.org> case.

Do you know where I can the code for a simplified start script and config?

So the code in both of the below files is quite different.

<webroot>/protected/config/main.php

<webroot>/protected/config/production.main.php

However I don’t see anything in either that I have any clue as to what I can add/change.

I tried putting the code from production.main.php into main.php but receive the same error:

Here is the production.main code:

And main.php

Is the Internal Server Error - include(Controller.php) message the issue that should be fixed? The file exists in the Components folder so why does this message appear. What should be be looking at?

The Controller in Components directory may be a customized controller extending from the frameworks CController. It should be loaded because import lists ‘application.components.*’. Strange.

The server config just overlays the mail and db application components. Can be managed in the local config. Also there is an additional parameter “‘mpdf5Path’=>’/vendors/MPDF54/mpdf.php’,” (seemingly for pdf generation).

In the local config there is a dependency on $env but the code referring to $isLocal is commented, so unless referred to from elsewhere (CApplication? code), should not be a problem.

(Also search all files for YII_ENVIRONMENT, may be a dependence somewhere on "local" or <mydomain.org>)

There is a lot of rules for the urlManager component. By setting showScriptName to true you won’t need the redirection in .htaccess.

First goal should be to see your applications start page. Tell us exactly what you see (screen shot).

Simple start script.


<?php

error_reporting( error_reporting() & ~E_NOTICE );


$yii = dirname(__FILE__) . '/protected/framework/yii.php';

$config = dirname(__FILE__) . '/protected/config/main.php';


// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG', 1);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);


require_once($yii);

Yii::createWebApplication($config)->run();



Local config, better readability


<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.


$isLocal = $env == 'local';


return array(

  'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',

  'name' => 'XX',


  // preloading 'log' component

  'preload' => array('log'),

  'language' => 'en',


  // autoloading model and component classes

  'import' => array(

  'application.models.*',

  'application.components.*',

  'application.vendor.*',

  'application.helpers.*',

  //'application.extensions.jtogglecolumn.*',

  'ext.mail.YiiMailMessage',

  'ext.jui.EJuiDateTimePicker',

  'application.extensions.easyPaypal.*'

  ),

  

  'modules' => array(

  // uncomment the following to enable the Gii tool

    'gii' => array(

      'generatorPaths' => array(

        'bootstrap.gii'

      ),

      'class' => 'system.gii.GiiModule',

      'password' => 'XX',

      // If removed, Gii defaults to localhost only. Edit carefully to taste.

      'ipFilters' => array('127.0.0.1', '::1'),

    ),

  ),


  // application components

  'components' => array(

    'user' => array(

      // enable cookie-based authentication

      'allowAutoLogin' => true,

      'class' => 'WebUser'

    ),


    'akthumb' => array(

      'class' => 'ext.thumb.AkThumb',

    ),


    'clientScript' => array(

      'coreScriptPosition' => 2, //CClientScript::POS_END

      'defaultScriptPosition' => 2, //CClientScript::POS_END

      'defaultScriptFilePosition' => 2, //CClientScript::POS_END

      /*

      'class' => 'application.vendor.yii-EClientScript.EClientScript',

      'combineScriptFiles' => !$isLocal, // By default this is set to true, set this to true if you'd like to combine the script files

      'combineCssFiles' => !$isLocal, // By default this is set to true, set this to true if you'd like to combine the css files

      'optimizeScriptFiles' => !$isLocal, // @since: 1.1

      'optimizeCssFiles' => !$isLocal, // @since: 1.1

      'optimizeInlineScript' => false, // @since: 1.6, This may case response slower

      'optimizeInlineCss' => false, // @since: 1.6, This may case response slower

      *

      */

    ),


    // uncomment the following to enable URLs in path-format

    'urlManager' => array(

      'urlFormat' => 'path',

      'showScriptName' => false,

      'rules' => array(

        'category/front/<slug:[\w\-]+>' => 'category/viewBySlug',

        'r/<type:[\w\-]+>/<category_id:\d+>' => 'resource/list',

        'r/front/<slug:[\w\-]+>/<type:\d+>' => 'resource/viewBySlug',

        'r/front/<slug:[\w\-]+>/<type:\d+>/<category_id:\d+>' => 'resource/viewBySlug',

        'event/list/<type:[\w\-]+>' => 'event/list',

        'event/front/<slug:[\w\-]+>' => 'event/viewBySlug',

        'newsletter/front/<slug:[\w\-]+>' => 'newsletter/viewBySlug',

        '/login' => 'site/login',

        '/logout' => 'site/logout',

        'page/<view:\w+>' => 'site/page',

        'p/<slug:[\w\-]+>' => 'cms/viewBySlug',

        '/contact' => 'site/contactus',

        'search' => 'site/search',

        'sitemap' => 'site/sitemap',

        '/enews' => 'subscriber/subscribe',

        '/newsletter' => 'newsletter/list',

        '/registerMember' => 'user/registerMember',

        '/registerSaved' => 'user/registerSaved',

        'activateUser/<token:[\w\-]+>' => 'site/activateUser',

        '<controller:\w+>/<id:\d+>' => '<controller>/view',

        '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

        '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

        'login' => 'site/login',

        'iforgot' => 'site/forgot',

      ),

    ),


    'db' => array(

      'connectionString' => 'sqlite:' . dirname(__FILE__) . '/../data/testdrive.db',

    ),


    // uncomment the following to use a MySQL database

    'db' => array(

      'connectionString' => 'mysql:host=127.0.0.1;dbname=XX',

      'emulatePrepare' => true,

      'username' => 'XX',

      'password' => 'XX',

      'charset' => 'utf8',

    ),


    'errorHandler' => array(

      // use 'site/error' action to display errors

      'errorAction' => 'site/error',

    ),


    'log' => array(

      'class' => 'CLogRouter',

      'routes' => array(

        array(

            'class' => 'CFileLogRoute',

            'levels' => 'error, warning',

          ),

        // uncomment the following to show log messages on web pages

        /*

        array(

          'class'=>'CWebLogRoute',

        ),

        */

      ),

    ),


    'mail' => array(

      'class' => 'ext.mail.YiiMail',

      'transportType' => 'smtp',

      'transportOptions' => array(

        'host' => 'idreamhtml.com',

        //'encryption' => 'ssl', // use ssl

        'username' => 'XX',

        'password' => '',

        'port' => 25, // ssl port for gmail

      ),

      'viewPath' => 'application.layouts.mails',

      'logging' => true,

      'dryRun' => false

    ),


    'image' => array(

      'class' => 'application.extensions.image.CImageComponent',

      // GD or ImageMagick

      'driver' => 'GD',

      // ImageMagick setup path

      'params' => array('directory' => '/opt/local/bin'),

    ),

  ),


  // application-level parameters that can be accessed

  // using Yii::app()->params['paramName']

  'params' => array(

    // this is used in contact page

    'adminEmail' => 'XX',

    'defaultPageSize' => '25',


    'googleMapApiKey' => 'XX',


    // PayPal Settings

    'PAYPAL_API_USERNAME' => 'XX',

    'PAYPAL_API_PASSWORD' => 'XX',

    'PAYPAL_API_SIGNATURE' => 'XX',

    'PAYPAL_MODE' => 'sandbox1' // sandbox/live default=sandbox

  ),

);



Thanks.

I updated the index.php and main.php with what you posted. See error when accessing the index.php attached.

As you can see the the actionIndex in SiteController is called. This is the default route. In actionIndex an attempt is made to retrieve what seems to be a "featured video".

The db table is not found in the configured db. Check which table name is in the $tablename variable (in protected/model/video.php). Seems to be missing in the db.

Assuming you’ve exported (at least) db structure from the old server and imported into the new server.

I had exported the db from the current existing live site phpmyadmin, and imported it via phpmyadmin onto the new server as normal.

The db’s are identical.

(I read that when importing a db through phpmyadmin, it can change any uppercase values to lowercase. Could that have anything to do with this?)

Can i somehow remove the reference to the video table to see if that makes a difference?

When looking at all the table names in the db, there is nothing named ‘Video’, although it finds the word in other tables.