Monday, July 8, 2013

Alias "{alias}" is invalid. Make sure it points to an existing PHP file and the file is readable.

The following error occur on my Yii web app
Alias "ext.dropdown.DropDownBox" is not valid.  Make sure it points to an existing PHP file and the file is readable.
I have checked that all of the permission is readable. This error only occurs in production and not in our test environment (mac and windows).
It turns out that our prod environment is using Centos and in my code I call
"$this->widget('ext.dropdown.DropDownBox', array(..." which should have been
"$this->widget('ext.dropDown.DropDownBox', array(..." 
Centos is very strict on case sensitivity. My extension folder name is with capital D "dropDown" and therefore I should have called the extension with capital D. 
D:\xampp\YII\framework\YiiBase.php(316)
304         if($isClass && (class_exists($className,false) || interface_exists($className,false)))
305             return self::$_imports[$alias]=$className;
306 
307         if(($path=self::getPathOfAlias($alias))!==false)
308         {
309             if($isClass)
310             {
311                 if($forceInclude)
312                 {
313                     if(is_file($path.'.php'))
314                         require($path.'.php');
315                     else
316                         throw new CException(Yii::t('yii','Alias "{alias}" is invalid. Make sure it points to an existing PHP file and the file is readable.',array('{alias}'=>$alias)));
317                     self::$_imports[$alias]=$className;
318                 }
319                 else
320                     self::$classMap[$className]=$path.'.php';
321                 return $className;
322             }
323             else  // a directory
324             {
325                 if(self::$_includePaths===null)
326                 {
327                     self::$_includePaths=array_unique(explode(PATH_SEPARATOR,get_include_path()));
328                     if(($pos=array_search('.',self::$_includePaths,true))!==false)

Friday, July 5, 2013

Jenkins fecthing upstream git changes take forever

Started by user anonymous
Building remotely on Windows Server 2003 in workspace c:\jenkins\workspace\your_app
Checkout:your_app / c:\jenkins\workspace\your_app - hudson.remoting.Channel@4296f09:Windows Server 2003
Using strategy: Default
Last Built Revision: Revision 9dc0a0401d62dd02f41a85ce00450d23ca85114f (origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
.
.
.
.

It just never ends

To solve this:

1. Go to your jenkins server
2. Go to jenkins workspace and do git pull
3. 
The authenticity of host '192.168.1.15 (192.168.1.15)' can't be established.
RSA key fingerprint is 6e:a3:e2:b5:b4:9f:02:4c:35:50:4f:8f:52:57:2b:d0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.15' (RSA) to the list of known hosts.
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 11 (delta 9), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From 192.168.1.15:k24/obat24

The reason jenkins does not work is because git is asking whether you want to add the rsa key fingerprint. You need to do this once manually and after that jenkins will be able to do the git pull for you.

Monday, July 1, 2013

Yii Require Once Error Cpanel

I tried to install Yii the first time on my cpanel hosting. However, when I try to launch my website I got the following errors:

Warning: require_once(/home/user_name/public_html/yii/demos/your_app/../../YII/framework/yii.php) [function.require-once]: failed to open stream: No such file or directory in /home/user_name/public_html/yii/demos/your_app/index.php on line 12

Fatal error: require_once() [function.require]: Failed opening required '/home/user_name/public_html/yii/demos/your_app/../../YII/framework/yii.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user_name/public_html/yii/demos/your_app/index.php on line 12

However, when I try the Yii demo apps like hangman, it works.

So I copied yii/demos/hangman/index.php to your_app/index.php file and it works. The reason I got the above error is because the yii path on my cpanel is different than on my local.

My cpanel index.php (I install yii on my public_html/yii)

<?php

// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

// remove the following line when in production mode
// defined('YII_DEBUG') or define('YII_DEBUG',true);

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