[RESUELTO] FirePHP

Seguí los pasos de "Integrating FirePHP" (http://www.yiiframew…oc/cookbook/84/).

Obtuve como resultado este error:




Fatal error: Uncaught exception 'CException' with message  'Alias "pmmii.components.FirePHPCore.fb" is invalid. Make sure it points to  an existing directory or file.' in  D:\www\docs\ps\yii\framework\YiiBase.php on line 282



Intenté con:

application.components.FirePHPCore.fb

application.protected.components.FirePHPCore.fb

Intenté también "forzarlo" con el "shiki", pero finalmente me dice q la función "fb" no existe…

¿Cómo hacer para que funcione el FirePhp?:unsure:

Gracias desde ya

/--------------------------------------------------/

Finalmente se logra hacer andar de este modo:




$app = Yii::createWebApplication($config);

if (YII_DEBUG){

 //   echo "[".Yii::getPathOfAlias("application")."]";

 //   die();

	Yii::import("application.components.FirePHPCore.fb", true);

}

$app->setLanguage(strstr(Yii::app()->request->preferredLanguage,'_',true));

$app->run();



Hasta donde comprendo, recién luego de createWebApplication puede utilizarse Yii::import y que funcione adecuadamente getPathOfAlias()

E.

E.

Es normal que eso te ocurriera puesto que primero has de crear la aplicacion. Al crearse el __construct de la clase CApplication es invokado y es el que inicia todos los alias de direccion.

Chequea la clase CApplication.

Un saludo!!

a mi tampoco me funcionó cookbook 84 :frowning:

este error me da

PHP Error

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





 		/var/www/yii/framework/YiiBase.php(396)





	384      * @return boolean whether the class has been loaded successfully

385 */

386 public static function autoload($className)

387 {

388 // use include so that the error PHP file may appear

389 if(isset(self::$_coreClasses[$className]))

390 include(YII_PATH.self::$_coreClasses[$className]);

391 else if(isset(self::$classMap[$className]))

392 include(self::$classMap[$className]);

393 else

394 {

395 if(strpos($className,’\\’)===false)

396 include($className.’.php’);

397 else // class name with namespace in PHP 5.3

398 {

399 $namespace=str_replace(’\\’,’.’,ltrim($className,’\\’));

400 if(($path=self::getPathOfAlias($namespace))!==false)

401 include($path.’.php’);

402 else

403 return false;

404 }

405 return class_exists($className,false) || interface_exists($className,false);

406 }

407 return true;

408 }

Stack Trace

			 						 			 				#0			 			 				 											+ 						– 										 /var/www/yii/framework/YiiBase.php(396): [b]YiiBase[/b]::[b]autoload[/b]()				  				391         else if(isset(self::$classMap[$className]))

392 include(self::$classMap[$className]);

393 else

394 {

395 if(strpos($className,’\\’)===false)

396 include($className.’.php’);

397 else // class name with namespace in PHP 5.3

398 {

399 $namespace=str_replace(’\\’,’.’,ltrim($className,’\\’));

400 if(($path=self::getPathOfAlias($namespace))!==false)

401 include($path.’.php’);

		 		 						 			 				#1			 			 				 										 unknown(0): [b]YiiBase[/b]::[b]autoload[/b]("FirePHP")				  							 		 						 			 				#2			 			 				 										 unknown(0): [b]spl_autoload_call[/b]("FirePHP")				  							 		 						 			 				#3			 			 				 											+ 						– 										 /var/www/acreditacion/protected/components/FirePHPCore/fb.php(45): [b]class_exists[/b]("FirePHP")				  				40  * @author      Christoph Dorn <christoph@christophdorn.com>

41 * @license http://www.opensource.org/licenses/bsd-license.php

42 * @package FirePHPCore

43 */

44

45 if(!class_exists(‘FirePHP’)) {

46 require_once dirname(FILE) . DIRECTORY_SEPARATOR . ‘FirePHP.class.php’;

47 }

48

49 /**

50 * Sends the given data to the FirePHP Firefox Extension.

		 		 						 			 				#4			 			 				 											+ 						– 										 /var/www/yii/framework/YiiBase.php(309): [b]require[/b]("/var/www/acreditacion/protected/components/FirePHPCore/fb.php")				  				304             if($isClass)

305 {

306 if($forceInclude)

307 {

308 if(is_file($path.’.php’))

309 require($path.’.php’);

310 else

311 throw new CException(Yii::t(‘yii’,‘Alias “{alias}” is invalid. Make sure it points to an existing PHP file.’,array(’{alias}’=>$alias)));

312 self::$_imports[$alias]=$className;

313 }

314 else

		 		 						 			 				#5			 			 				 											+ 						– 										 /var/www/acreditacion/index.php(16): [b]YiiBase[/b]::[b]import[/b]("application.components.FirePHPCore.fb", true)				  				11 

12 require_once($yii);

13 //inicio FirePHP

14 $app = Yii::createWebApplication($config);

15 if (YII_DEBUG){

16 Yii::import("application.components.FirePHPCore.fb", true);

17 }

18 $app->setLanguage(strstr(Yii::app()->request->preferredLanguage,’_’,true));

19 $app->run();

20 //fin Firephp

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

		 		 				 	  	 		2011-05-10 17:03:41 Apache/2.2.14 (Ubuntu) [url="../../../../"]Yii Framework[/url]/1.1.7	     

probé así

// change the following paths if necessary

$yii=dirname(FILE).’/../yii/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’,true);

// 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);

//inicio FirePHP

$app = Yii::createWebApplication($config);

if (YII_DEBUG){

Yii::import("application.components.FirePHPCore.fb", true); 

}

$app->setLanguage(strstr(Yii::app()->request->preferredLanguage,’_’,true));

$app->run();

//fin Firephp

y así

// change the following paths if necessary

$yii=dirname(FILE).’/../yii/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’,true);

// 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);

//inicio FirePHP

$app = Yii::createWebApplication($config);

if (YII_DEBUG){

Yii::import("application.components.FirePHPCore.fb", true); 

}

$app->run();

//fin Firephp

y nada

en mi /var/ww/acreditacion/protected/components/FirePHPCore están los siguientes archivos

fb.php

fb.php4

FirePHP.class.php

FirePHP.class.php4

LICENSE

pero nada.

In Controller.php located in Components folder put this following code

public function init(){

parent::init();


    if(YII_DEBUG){


    spl_autoload_unregister(array('YiiBase','autoload'));


        require_once (dirname(__FILE__).'/../components/FirePHPCore/fb.php');


       spl_autoload_register(array('YiiBase', 'autoload'));


   }

}

Yo realice de esta manera.

En el index.php hice el include del FirePHP




require_once($yii);

require_once '../FirePHPCore/FirePHP.class.php';

ob_start();

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



Luego en donde quiero utilizar




$miFire = FirePHP::getInstance(true);

$miFire->log($someObject, 'Mensaje');



Y me funciona sin problemas