Yii Exception: Alias “user.UserModule” is invalid

I was attempting to get the Yii Framework yii-user extension working for a test web site earlier today when I got this fatal error / exception message:

Alias “user.UserModule” is invalid. Make sure it points to an existing PHP file and the file is readable.

Despite what others have already reported (online), my error was simply caused by a faulty folder permission setting. You see, when I unzipped the archive file (yii-user-0.3-61-gfc69518.zip), it did not occur to me to check the permissions of all the directories in the extracted directory. When I finally thought about checking the folder permissions, this is what I found:

[woohoo@beefong ~]$ ls -l $HOME/Downloads
total 999
...
drwx------. 9 woohoo woohoo      4096 Mar  1 03:58 mishamx-yii-user-fc69518
-rw-rw-r--. 1 woohoo woohoo    303287 Feb 28 18:24 yii-user-0.3-61-gfc69518.zip
...

[woohoo@beefong ~]$ ls -l $HOME/Downloads/mishamx-yii-user-fc69518
total 40
drwx------.  2 woohoo woohoo 4096 Mar  1 03:58 components
drwx------.  2 woohoo woohoo 4096 Mar  1 03:58 controllers
drwx------.  2 woohoo woohoo 4096 Mar  1 03:58 data
drwx------. 14 woohoo woohoo 4096 Mar  1 03:58 messages
drwx------.  2 woohoo woohoo 4096 Mar  1 03:58 migrations
drwx------.  2 woohoo woohoo 4096 Mar  1 03:58 models
-rw-rw-r--.  1 woohoo woohoo 3472 Jun 12  2012 README.md
-rw-rw-r--.  1 woohoo woohoo 6267 Jun 12  2012 UserModule.php
drwx------.  8 woohoo woohoo 4096 Mar  1 03:58 views

Every folder and subfolder created with permission set to 700

Rookie mistake, I know! :-)

Solution: Change all folder permissions to 755/775

Using the find & chmod commands together, I changed the permissions of the extracted directory and its sub-directories like this:

find $HOME/Downloads/mishamx-yii-user-fc69518 -type d -exec chmod 775 {} \;

After that, the folders looked like this:

[woohoo@beefong ~]$ ls -l $HOME/Downloads
total 999
...
drwxrwxr-x. 9 woohoo woohoo      4096 Mar  1 03:58 mishamx-yii-user-fc69518
-rw-rw-r--. 1 woohoo woohoo    303287 Feb 28 18:24 yii-user-0.3-61-gfc69518.zip
...

[woohoo@beefong ~]$ ls -l $HOME/Downloads/mishamx-yii-user-fc69518
total 40
drwxrwxr-x.  2 woohoo woohoo 4096 Mar  1 03:58 components
drwxrwxr-x.  2 woohoo woohoo 4096 Mar  1 03:58 controllers
drwxrwxr-x.  2 woohoo woohoo 4096 Mar  1 03:58 data
drwxrwxr-x. 14 woohoo woohoo 4096 Mar  1 03:58 messages
drwxrwxr-x.  2 woohoo woohoo 4096 Mar  1 03:58 migrations
drwxrwxr-x.  2 woohoo woohoo 4096 Mar  1 03:58 models
-rw-rw-r--.  1 woohoo woohoo 3472 Jun 12  2012 README.md
-rw-rw-r--.  1 woohoo woohoo 6267 Jun 12  2012 UserModule.php
drwxrwxr-x.  8 woohoo woohoo 4096 Mar  1 03:58 views

Eventually the folder: $HOME/Downloads/mishamx-yii-user-fc69518 was moved to its correct place with a quick mv command:

[woohoo@beefong ~]$ mv $HOME/Downloads/mishamx-yii-user-fc69518 $HOME/public_html/protected/modules/user

Now everything about the yii-user extension is working as it should.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>