moving a database to a new server


Very new to Yii and starting to familiarize myself… we’ve recently copied a database to a new server and adjusted the main.php in the config folder to reflect the new settings. While we are able to view the log in page, we seem to be running into path or 404 errors after trying to log in. Is it possible to move databases’ like this, or do you require an install of latest Yii software on the target computer for migration from one server to the new one…

Any help would be much appreciated…

If you have just changed the database server than edits in the main.php should be enough as far as I can know. Please, tell us little bit more information.

May be two reason -

  1. If you move to different database like - MySQL to SQL than you need to update your connection string.

  2. Please check your new server MySQL or SQL port. is it open/enable or not??

Thanks Rohit,

We checked those items and they are configured properly. The problem lies in the fact that the url requires us to look at a specific port when querying the server. So i’ve found a way in CHttpRequest to default the port to the one i am looking for. There is a setPort() function, but seeing that i am only 20 pages into some online documentation about Yii I have a bit more reading to go. I’ve tried to configure the port for the URL in the main.php file in the config folder but that does not seem to be the right place to do so, (or i am doing this improperly).

Hi, I’m not quite sure, but in the main.php you can maybe set port attribute of the component request like this:










Thanks, i gave that a try but didn’t have luck, ended up setting the default port in the CHttpRequest file to the proper port, and that seems to have worked nicely. Appreciate your comments.