Author Topic: How facilitate debugging of FengOffice's PHP code with FirePHP  (Read 4426 times)

waldo2188

  • Newbie
  • *
  • Posts: 6
    • View Profile
How facilitate debugging of FengOffice's PHP code with FirePHP
« on: September 21, 2010, 06:31:17 am »
This is a short how-to for use the Mozilla Firefox extension, FirePHP.

Reminder : FirePHP enables you to log to your Firebug Console using a simple PHP method call.

First you need Firefox and the FireBug extension (https://addons.mozilla.org/fr/firefox/addon/1843/).
Next, you must install the FirePHP extension (https://addons.mozilla.org/fr/firefox/addon/6149/) and download the corresponding PHP classes (http://www.firephp.org/).

Unzip PHP Classes in 'fengOffice/environment/library/FirePHPCore/' directory.
If you use PHP 5 you can delete PHP 4 classes (fb.php4 and FirePHP.class.php4).

Rename the file fb.php to FB.class.php. We rename this file for a better integration in the FengOffice class autoload system.

Edit 'fengOffice/init.php'.
After :
Code: [Select]
// Set handle request timer...
if(Env::isDebugging()) {
benchmark_timer_set_marker('Handle request');
} // if

insert this code :
Code: [Select]
// Enable FirePHP
if(Env::isDebugging()) {
FB::setEnabled(true);
} // if

Now you can use FirePHP static methods, like :
Code: [Select]
FB::log('Log message');
FB::info('Info message');
FB::warn('Warn message');
FB::error('Error message');

Have a nice day!

franponce87

  • Administrator
  • Hero Member
  • *****
  • Posts: 1819
    • View Profile
    • Email
Re: How facilitate debugging of FengOffice's PHP code with FirePHP
« Reply #1 on: September 24, 2010, 02:51:57 pm »
Very informative post which will help a lot of people! I myself will try it out soon and see how it works, thanks a lot for your contribution!

Best regards,
Francisco
Would you like to install Feng Office Professional or Enterprise Edition in your servers? No problem! Read this article!