Yii-User Extension Works On Localhost But Not On Server

[SOLVED] Make sure the user module directory (within protected/modules/ folder) starts with an undercase: "User" should be changed to "user".

I am using the yii-user extension and it worked fine until I uploaded it to my web server. On localhost, user registration works (saw new accounts in the database), but it never sent the activation email. I found out this wasn’t a problem with the extension itself because the default contact page also never sends an email to me, but did when I tried it on my server.

So on the web server, the About and Contact pages work, but when I click on either Login or Register, I get a CException with this error message:

I’ve searched online extensively trying to find out what the problem is / how to fix it, but it’s very frustrating that all the answers I’ve found refer to the yii-user-management extension, not yii-user!

I’ll provide code snippets from my project when necessary, I just don’t know which parts you guys need to see. The stack traces are exactly the same for both the Registration and Login page errors, except for stacks #3 and #4 where they have different controllers (“user/regisration” vs “user/login”):

Stack trace:

#0 /f5/spartanworker/protected/yii/framework/YiiBase.php(196): YiiBase::import("user.UserModule", true)

#1 /f5/spartanworker/protected/yii/framework/base/CModule.php(282): YiiBase::createComponent("user.UserModule", "user", null, array("hash" => "md5", "sendActivationMail" => true, "loginNotActiv" => false, "activeAfterRegister" => false, ...))

#2  /f5/spartanworker/protected/yii/framework/web/CWebApplication.php(337): CModule->getModule("user")

#3 /f5/spartanworker/protected/yii/framework/web/CWebApplication.php(276): CWebApplication->createController("user/registration")

#4 /f5/spartanworker/protected/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("user/registration")

#5 /f5/spartanworker/protected/yii/framework/base/CApplication.php(180): CWebApplication->processRequest()

#6 /f5/spartanworker/public/thearc/index.php(15): CApplication->run()

I guess it’s worth noting that the yii framework directory location is different on my server compared to localhost, but I take care of that while uploading:

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

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

Even though this might deserve a separate post, I’d like to hear the main differences between yii-user and yii-user-management extensions, specifically when it comes to adding new modules - which one is more flexible? I want to stick with yii-user, but if there is any compelling reason to use the other extension, I’ll consider it.

Do you upload your application as a whole or skip the config, because it’s different on the server? Anyway, post the config that is used on your server.

Judging from the error message, either the module directory does not exist or the modules default location has changed.

Do you use composer and symlinks?

it seems to be a problem of path and filename.

I did upload the application as a whole, didn’t do any of the initial command line commands to build it. I don’t think I think I used symlinks when I created the site locally, so could that be causing an issue on the server? How would I create the symlinks on the server?

Here is my main.php within the config folder (with passwords/emails/database names removed):


// 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.

return array(


	'name'=>'Site Name',

	// preloading 'log' component


	// autoloading model and component classes









		// uncomment the following to enable the Gii tool





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





			# encrypting method (php hash function)

			'hash' => 'md5',


			# send activation email

			'sendActivationMail' => true,


			# allow access for non-activated users

			'loginNotActiv' => false,


			# activate user on registration (only sendActivationMail = false)

			'activeAfterRegister' => false,


			# automatically login from registration

			'autoLogin' => true,


			# registration path

			'registrationUrl' => array('/user/registration'),


			# recovery password path

			'recoveryUrl' => array('/user/recovery'),


			# login form path

			'loginUrl' => array('/user/login'),


			# page after login

			'returnUrl' => array('/user/profile'),


			# page after logout

			'returnLogoutUrl' => array('/user/login'),




	// application components



			// enable cookie-based authentication


			'class'=> 'application.components.WebUser',



		'mail' => array(

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

				'transportType' => 'smtp',

				'transportOptions' => array(

				'host' => 'smtp.gmail.com',

				'username' => 'nope',

				'password' => 'nope',

				'port' => '465',



			'viewPath' => 'application.views.mail',

			'logging' => true,

			'dryRun' => false





			'showScriptName' => false,


				'' => '/site/index',

				'about' => '/site/about',

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

				'login' => '/user/login',

				'registration' => 'user/registration',







// 		'db'=>array(

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

// 			'tablePrefix' => 'tbl_',

// 		),




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

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '',

			'charset' => 'utf8',




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








					'levels'=>'error, warning',


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









	// application-level parameters that can be accessed

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


		// this is used in contact page




And the user model is located under protected/models/user? Can you verify that this directory exists on the server?

I don’t have a user folder within protected/models/, but I do have PHP files for User, UserChangePassword, UserLogin, and UserRecoveryForm. I probably put them there manually before the local site was working for me, and I don’t even know if they do anything.

Under protected/modules/, I have the User folder which contains everything from the extension. I had to rename the existing User folder to User-OLD since I no longer needed it. The User folder is also found at the same location on the server.

Sorry, that was a typo, I meant protected/MODULES/user. You said your folders are named with a capital U? Maybe you’re using Windows? On Windows, folders are case insensitive and your server is probably running some kind of Linux, where case matters.

Hey, changing it to lowercase on the server did make a difference! I was able to view the Login tab successfully, but when I tried logging in I got this error:

CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory

I fixed that on my own by changing the DB connection values inside config/main.php to match my server - now both logging in and registration work! Thank you for the help @nineinchnick. I hope this thread prevents other people in the future from going through the same pains I went through.