SlideShare a Scribd company logo
1 of 12
Download to read offline
Xoops Documentation Series
www.xoops.org© 2012 XOOPS Project
Debugging XOOPS
With FirePHP/Firebug
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 2 of 12 XOOPS Documentation Team
All About XOOPS:
XOOPS is a Content Management System (CSM) and a Web Portal program that allows administrators to easily create dynamic
websites with great content and many outstanding features. It is an ideal tool for developing small to large dynamic community
websites, intra company portals, corporate portals, weblogs and much more. It can be installed on an Internet host with a PHP-
capable web server (e.g., Apache) and a database (e.g., MySQL).
The main Project websites is www.xooops.org
XOOPS is released under the terms of the GNU General Public License (GPL) and is free to use and modify. It is free to redistribute
as long as you abide by the distribution terms of the GPL.
What XOOPS stands for:
XOOPS is an acronym of eXtensible Object Oriented Portal System. Though started as a portal system, XOOPS is in fact striving
steadily on the track of Content Management System. It can serve as a web framework for use by small, medium and large sites.
It is highly scalable, from a personal weblog or journal through a community website to an enterprise installation. It has numerous
modules that can be used to create all the basic functionality required of the system, e.g. News, Forums, Downloads, MyLinks etc.
Customized modules can also be developed by users and integrated seamlessly with the core to serve specific needs such as
eCommerrce.
Pronunciation guide
The standard pronunciation of XOOPS follows English rules, and is pronounced [zoo'ps].
Key features of XOOPS
Database-driven
XOOPS uses a relational database (currently MySQL) to store data required for running a web-based content management system.
Fully Modularized
Modules can be installed, uninstalled, and activated or deactivated with a click using the XOOPS module administration system.
Personalization
Registered users can edit their profiles, select site themes, upload custom avatars, and much more!
User Management
XOOPS offers users the ability to search for users by various criteria, and send email or private messages to other users through a
template-based messaging system.
Supported World-wide
XOOPS was created and is maintained by a team of several hard-working volunteers from all over the world. The XOOPS
Community has more than a dozen official support sites around the world for support of non-English speaking users.
Multi-byte Language Support
XOOPS fully supports multi-byte languages, including Japanese, Simplified and Traditional Chinese, and Korean among others.
Versatile Group Permissions System
XOOPS comes with a powerful and user-friendly permissions system which enables administrators to set permissions by group.
Theme-based skinnable interface
XOOPS is driven by a powerful theme system. Both administrators and users can change the look of the entire web site with just a
click of a mouse. There are also over 60 themes available for download!!
XOOPS has received numerous awards:
It was a Finalist for the Best Project of SourceForge 2008 Community Awards and finalist for Best PHP Open Source CMS
organized by Packt Publishing. In addition, XOOPS received Awards from “Adobe Edge” as a Top CMS, received 5 out of 5 Stars
from Germany's CHIP Magazine, or placed as a top CMS on a list published by ONDD.
XOOPS has over 6,600,000 downloads from the SourceForge Website and is with that the #1 CMS (Content Management System)
on SourceForge.
Authors: Michael Beck (Mamba)
Published 2012-02-14 Copyright © 2003-12 XOOPS Project
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 3 of 12 XOOPS Documentation Team
1. INTRODUCTION 4
2. DEBUGGING IN XOOPS 4
2.1 PHP DEBUG 4
2.2 MYSQL DEBUG 4
2.3 SMARTY DEBUG 4
2.4 SETTING XOOPS DEBUGGING 5
2.4.1 CHANGING XOOPS DEBUG MODE DIRECTLY IN THE DATABASE 6
2.4.2 SETTING CONFIGURATION 6
3. DEBUGGING TOOLS 7
3.1 XDEBUG 7
3.2 FIREBUG 7
3.3 FIREPHP 8
4. PHP DEBUGGING WITHOUT XOOPS 9
4.1 HISTORY 9
4.2 INSTALLATION 9
4.3 USING FIREPHP/FIREBUG WITH XOOPS 9
4.4 FEEDBACK 12
Table of Figures
FIGURE 1: SELECTING XOOPS GENERAL SETTINGS ......................................................................................................5
FIGURE 2: SELECTING DEBUG MODE .............................................................................................................................5
FIGURE 3: CONTROL ADMIN SIDE ..................................................................................................................................5
FIGURE 4: FRONT SIDE ...................................................................................................................................................6
FIGURE 5: WAMP SERVER.............................................................................................................................................7
FIGURE 6: FIREPHP WITH MESSAGES IN FIREBUG’S CONSOLE .......................................................................................8
FIGURE 7: FIREBUG WITH FIREPHP AND XOOPS DEBUG MESSAGES ...........................................................................10
FIGURE 8: XOOPS DEBUG MESSAGES IN XOOPS........................................................................................................10
FIGURE 9: XOOPS DEBUG MESSAGES IN FIREBUG.......................................................................................................11
FIGURE 10: FIREBUG WITH DETAILED FIREPHP VARIABLE INFO ..................................................................................12
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 4 of 12 XOOPS Documentation Team
1. INTRODUCTION
As defined in Wikipedia, “Debugging is a methodical process of finding and reducing the number of bugs,
or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected.
Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may
cause bugs to emerge in another.”
XOOPS is a complex PHP script, and therefore when new features are added, there is always a risk that
they will introduce new bugs, or break some old code.
Therefore debugging is a very important activity for every XOOPS developer.
Note: for this tutorial as a Test Server we are using WAMP Server from: http://www.wampserver.com/, a
free and Open Source web development environment on Windows. It allows you to create web
applications with Apache, PHP and the MySQL database. It also comes with PHPMyAdmin to easily
manage your databases.
2. DEBUGGING IN XOOPS
XOOPS has three levels of debugging; PHP debug, MySQL debug and Smarty debug.
If you suspect that your site may have faults there are several tools built into XOOPS that can help
diagnose the problem.
2.1 PHP Debug
The first is PHP Debug Mode that enables PHP errors to show on the screen.
If PHP debug is not on, the system will suppress error messages coming from the PHP code.
This is the main reason for the dreaded "Blank Page" problem, which is caused by an error in the PHP
code, so serious that the interpretation of the code can no longer continue.
Enabling PHP debug will often result in these blank pages showing an error message instead.
2.2 MySQL Debug
The second tool is Mysql/Blocks Debug. This gives a popup out put of MySQL queries as well as other
useful information.
With this debugging setting enabled, a window will popup after each page load, showing the database
queries, executed on the page. It will also show which blocks and templates are used on the page along
with caching information (whether the block or template is cached)
Faulty SQL queries will be highlighted in red with a MySQL error message appended
2.3 Smarty Debug
The third tool built into Xoops is the Smarty Templates Debug mode. It is very useful not only for
troubleshooting problems but also to assist in design of themes and templates. It shows the Smarty
Variables and what they are assigned to on a given page.
Smarty debug settings will open a new window on all pages using Smarty templates, showing all
variables assigned to Smarty along with their values. This debug setting is useful if you know that there
are no PHP errors, that the SQL queries execute successfully, but the information does not show up as
expected. Quite often it is a matter of organising the information correctly for display which is only
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 5 of 12 XOOPS Documentation Team
discovered by looking at the actual values in each Smarty variable. An example is information in an array,
which the template is coded to take from a sub-array instead - or vice versa.
2.4 Setting XOOPS Debugging
As default, the Debug Mode is set to off. In order to activate Debug in XOOPS, please go to the menu:
Preferences  System Options  General Settings:
Figure 1: Selecting XOOPS General Settings
This will open the General Settings form, where you can find the options for Debug Mode:
Figure 2: Selecting Debug Mode
Most of the time, we select the first option: “Enable debug (inline mode)”.
Once this done, XOOPS will show all debug information at the bottom of the page:
Figure 3: Control Admin Side
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 6 of 12 XOOPS Documentation Team
Figure 4: Front Side
2.4.1 Changing XOOPS Debug Mode directly in the database
What to do when you don’t have access to the Admin to set the Debug mode there, e.g. when there are
bugs that cause a “blank screen of death”?
There are two ways to change the XOOPS Debug Mode:
1) You can do it directly in phpMyAdmin
2) You can run a MySQL query to
UPDATE XXXX_config SET conf_value=YYYY WHERE conf_modid=0 AND conf_catid=1 AND conf_name='debug_mode'
Replace XXXX with the value of XOOPS_DB_PREFIX in mainfile.php (default is "xoops").
Replace YYYY (Debug Mode) with:
0, for Off
1, for Debug Inline mode
2, for Debug in pop-up mode
3, for Smarty Template Debug
2.4.2 Setting Configuration
Now the problem is that these messages will be visible to all users. But if we don’t want that, then
XOOPS offers following configuration option, stored in
/xoops_data/configs/xoopsconfig.php
Just select the right debug level that you want by keeping the “0” or replacing it with “1” or “2”:
/**#@+
* Debug level for XOOPS
*
* <ul>Displaying debug information to different level(s) of users:
* <li> 0 - To all users</li>
* <li> 1 - To members</li>
* <li> 2 - To admins only</li>
* </ul>
*/
/**#@-*/
"debugLevel" => 0,
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 7 of 12 XOOPS Documentation Team
3. EXTERNAL DEBUGGING TOOLS
3.1 XDebug
Xdebug is a PHP extension which provides debugging and profiling capabilities.
The debug information that Xdebug can provide includes the following:
 stack and function traces in error messages with:
o full parameter display for user defined functions
o function name, file name and line indications
o support for member functions
 memory allocation
 protection for infinite recursions
Xdebug also provides:
 profiling information for PHP scripts[3]
 code coverage analysis
 capabilities to debug your scripts interactively with a debugger front-end.[4
If you use WAMP Server, it comes already with xDebug:
Figure 5: WAMP Server
To learn how to use xDebug, please read: http://devzone.zend.com/article/2803
3.2 Firebug
Firebug (http://getfirebug.com/) is one of those tools that every Web developers should have in his
toolbox. It integrates with Firefox as an extension, but it can be extended by itself, with many other ‘meta-
extensions” available for it, like YSlow, FireCookie, PixelPerfect, and FirePHP, which is the main focus of
this document.
The main features of Firebug:
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 8 of 12 XOOPS Documentation Team
 Inspect HTML and modify style and layout in real-time
 Use the most advanced JavaScript debugger available for any browser
 Accurately analyze network usage and performance
 Extend Firebug and add features to make Firebug even more powerful
3.3 FirePHP
FirePHP is a Mozilla Firefox plugin/extension that merges with Firebug and enables you to log to your
Firebug Console using a simple PHP method call. All data is sent via response headers and will not
interfere with the content on your page, therefore it is ideally suited for AJAX development where clean
JSON and XML responses are required.
Issue these calls and this is what you will get in Firebug:
Figure 6: FirePHP with messages in Firebug’s Console
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 9 of 12 XOOPS Documentation Team
4. PHP DEBUGGING WITHOUT XOOPS
4.1 History
Frankblack was frustrated with debugging his AJAX applications using just the standard Debug Mode,
therefore he ended up using FireBug + FirePHP as addons for Firefox, and he rewrote XOOPS
class/logger/render.php to output the XOOPS debug messages to FirePHP, resulting in a very flexible
solution. Trabis contributed as well, and now we have a solution that is very helpful to XOOPS
Developers.
4.2 Installation
Important – you have to have Firefox to use Firebug and FirePHP! Recommended: Ver. 4.0
There are few simple steps to get you going:
1) Download and install in Firefox the newest version of Firebug (currently 1.7) from here:
http://getfirebug.com/
2) Download and install in Firefox the latest version of FirePHP extension:
https://addons.mozilla.org/en-US/firefox/addon/firephp/
3) Download and install the FireDebug 1.6 for XOOPS 2.5.x
4) Go to xoops_data/configs/xoopsconfig.php and change the DebugLogger configuration to:
/**#@+
* Debug logger for XOOPS
*
* <ul>Choose logger to use
* <li> legacy </li>
* <li> pqp </li>
* <li> firephp </li>
* </ul>
*/
"debugLogger" => firephp,
/**#@-*/
and you’re ready to go.
4.3 Using FirePHP/Firebug with XOOPS
After installing the above tools, you can add this line your PHP file:
require_once XOOPS_ROOT_PATH.'/class/logger/firephp/FirePHPCore/fb.php';
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 10 of 12 XOOPS Documentation Team
and you can start sending messages to FirePHP:
FB::log('Log message');
FB::info('Info message');
FB::warn('Warn message');
FB::error('Error message');
FB::trace('Trace message');
Figure 7: Firebug with FirePHP and XOOPS debug messages
The messages from XOOPS are coming from XOOPS Debug, but XOOPS just redirects them to Firebug,
so you have all debug messages conveniently in one location.
Figure 8: XOOPS Debug messages in XOOPS
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 11 of 12 XOOPS Documentation Team
Figure 9: XOOPS Debug messages in Firebug
Additional advantage is that you also have Smarty Debug Output as well – all in one location.
When we want to see values of variables, we can send it as well, e.g.
FB::log($index_admin,'this is our ModuleAdmin class');
This will show in Firebug as:
Since there is more information than the line can hold, we can just click on that line and a new window will
open with all the details:
XU-105 XOOPS Debugging with FirePHP/Firebug
Last change: 2/13/2012 6:14 PM Page 12 of 12 XOOPS Documentation Team
Figure 10: Firebug with detailed FirePHP variable info
4.4 Feedback
This concludes our short tutorial on using FirePHP/Firebug in XOOPS.
If you have any improvement suggestions, please post them in our Documentation Forums:
http://xoops.org/modules/newbb/viewforum.php?forum=52

More Related Content

Similar to XOOPS 2.5.x Debugging with FirePHP/FireBug

XOOPS 2.5.x Installation Guide
XOOPS 2.5.x Installation GuideXOOPS 2.5.x Installation Guide
XOOPS 2.5.x Installation Guidexoopsproject
 
XOOPS 2.5.x Operations Guide
XOOPS 2.5.x Operations GuideXOOPS 2.5.x Operations Guide
XOOPS 2.5.x Operations Guidexoopsproject
 
CONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEMCONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEMANAND PRAKASH
 
Open Source in Higher Education 2007
Open Source in Higher Education 2007Open Source in Higher Education 2007
Open Source in Higher Education 2007ssorden
 
Building A Platform From Open Source At Yahoo
Building A Platform From Open Source At YahooBuilding A Platform From Open Source At Yahoo
Building A Platform From Open Source At YahooDustin Whittle
 
GTU MCA PHP Interview Questions And Answers for freshers
GTU MCA PHP  Interview Questions And Answers for freshersGTU MCA PHP  Interview Questions And Answers for freshers
GTU MCA PHP Interview Questions And Answers for freshersTOPS Technologies
 
Php hypertext Preprocessor
Php hypertext PreprocessorPhp hypertext Preprocessor
Php hypertext PreprocessorMrsRLakshmiIT
 
Day 2-presentation
Day 2-presentationDay 2-presentation
Day 2-presentationDeb Forsten
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessoradeel990
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)sparkfabrik
 
Joomla development services by experts fromindia
 Joomla development services by experts fromindia Joomla development services by experts fromindia
Joomla development services by experts fromindiaefisurbhi
 

Similar to XOOPS 2.5.x Debugging with FirePHP/FireBug (20)

XOOPS 2.5.x Installation Guide
XOOPS 2.5.x Installation GuideXOOPS 2.5.x Installation Guide
XOOPS 2.5.x Installation Guide
 
XOOPS 2.5.x Operations Guide
XOOPS 2.5.x Operations GuideXOOPS 2.5.x Operations Guide
XOOPS 2.5.x Operations Guide
 
CONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEMCONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEM
 
FAT.Seminar.FOSS_Joomla!
FAT.Seminar.FOSS_Joomla!FAT.Seminar.FOSS_Joomla!
FAT.Seminar.FOSS_Joomla!
 
JOOMLA
JOOMLAJOOMLA
JOOMLA
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Open Source in Higher Education 2007
Open Source in Higher Education 2007Open Source in Higher Education 2007
Open Source in Higher Education 2007
 
File handling
File handlingFile handling
File handling
 
Foucus learning to crawl web forums
Foucus learning to crawl web forumsFoucus learning to crawl web forums
Foucus learning to crawl web forums
 
Building A Platform From Open Source At Yahoo
Building A Platform From Open Source At YahooBuilding A Platform From Open Source At Yahoo
Building A Platform From Open Source At Yahoo
 
GTU MCA PHP Interview Questions And Answers for freshers
GTU MCA PHP  Interview Questions And Answers for freshersGTU MCA PHP  Interview Questions And Answers for freshers
GTU MCA PHP Interview Questions And Answers for freshers
 
Php hypertext Preprocessor
Php hypertext PreprocessorPhp hypertext Preprocessor
Php hypertext Preprocessor
 
Day 2-presentation
Day 2-presentationDay 2-presentation
Day 2-presentation
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessor
 
How PHP works
How PHP works How PHP works
How PHP works
 
Unit 1
Unit 1Unit 1
Unit 1
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Joomla development services by experts fromindia
 Joomla development services by experts fromindia Joomla development services by experts fromindia
Joomla development services by experts fromindia
 

Recently uploaded

What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 

Recently uploaded (20)

What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 

XOOPS 2.5.x Debugging with FirePHP/FireBug

  • 1. Xoops Documentation Series www.xoops.org© 2012 XOOPS Project Debugging XOOPS With FirePHP/Firebug
  • 2. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 2 of 12 XOOPS Documentation Team All About XOOPS: XOOPS is a Content Management System (CSM) and a Web Portal program that allows administrators to easily create dynamic websites with great content and many outstanding features. It is an ideal tool for developing small to large dynamic community websites, intra company portals, corporate portals, weblogs and much more. It can be installed on an Internet host with a PHP- capable web server (e.g., Apache) and a database (e.g., MySQL). The main Project websites is www.xooops.org XOOPS is released under the terms of the GNU General Public License (GPL) and is free to use and modify. It is free to redistribute as long as you abide by the distribution terms of the GPL. What XOOPS stands for: XOOPS is an acronym of eXtensible Object Oriented Portal System. Though started as a portal system, XOOPS is in fact striving steadily on the track of Content Management System. It can serve as a web framework for use by small, medium and large sites. It is highly scalable, from a personal weblog or journal through a community website to an enterprise installation. It has numerous modules that can be used to create all the basic functionality required of the system, e.g. News, Forums, Downloads, MyLinks etc. Customized modules can also be developed by users and integrated seamlessly with the core to serve specific needs such as eCommerrce. Pronunciation guide The standard pronunciation of XOOPS follows English rules, and is pronounced [zoo'ps]. Key features of XOOPS Database-driven XOOPS uses a relational database (currently MySQL) to store data required for running a web-based content management system. Fully Modularized Modules can be installed, uninstalled, and activated or deactivated with a click using the XOOPS module administration system. Personalization Registered users can edit their profiles, select site themes, upload custom avatars, and much more! User Management XOOPS offers users the ability to search for users by various criteria, and send email or private messages to other users through a template-based messaging system. Supported World-wide XOOPS was created and is maintained by a team of several hard-working volunteers from all over the world. The XOOPS Community has more than a dozen official support sites around the world for support of non-English speaking users. Multi-byte Language Support XOOPS fully supports multi-byte languages, including Japanese, Simplified and Traditional Chinese, and Korean among others. Versatile Group Permissions System XOOPS comes with a powerful and user-friendly permissions system which enables administrators to set permissions by group. Theme-based skinnable interface XOOPS is driven by a powerful theme system. Both administrators and users can change the look of the entire web site with just a click of a mouse. There are also over 60 themes available for download!! XOOPS has received numerous awards: It was a Finalist for the Best Project of SourceForge 2008 Community Awards and finalist for Best PHP Open Source CMS organized by Packt Publishing. In addition, XOOPS received Awards from “Adobe Edge” as a Top CMS, received 5 out of 5 Stars from Germany's CHIP Magazine, or placed as a top CMS on a list published by ONDD. XOOPS has over 6,600,000 downloads from the SourceForge Website and is with that the #1 CMS (Content Management System) on SourceForge. Authors: Michael Beck (Mamba) Published 2012-02-14 Copyright © 2003-12 XOOPS Project
  • 3. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 3 of 12 XOOPS Documentation Team 1. INTRODUCTION 4 2. DEBUGGING IN XOOPS 4 2.1 PHP DEBUG 4 2.2 MYSQL DEBUG 4 2.3 SMARTY DEBUG 4 2.4 SETTING XOOPS DEBUGGING 5 2.4.1 CHANGING XOOPS DEBUG MODE DIRECTLY IN THE DATABASE 6 2.4.2 SETTING CONFIGURATION 6 3. DEBUGGING TOOLS 7 3.1 XDEBUG 7 3.2 FIREBUG 7 3.3 FIREPHP 8 4. PHP DEBUGGING WITHOUT XOOPS 9 4.1 HISTORY 9 4.2 INSTALLATION 9 4.3 USING FIREPHP/FIREBUG WITH XOOPS 9 4.4 FEEDBACK 12 Table of Figures FIGURE 1: SELECTING XOOPS GENERAL SETTINGS ......................................................................................................5 FIGURE 2: SELECTING DEBUG MODE .............................................................................................................................5 FIGURE 3: CONTROL ADMIN SIDE ..................................................................................................................................5 FIGURE 4: FRONT SIDE ...................................................................................................................................................6 FIGURE 5: WAMP SERVER.............................................................................................................................................7 FIGURE 6: FIREPHP WITH MESSAGES IN FIREBUG’S CONSOLE .......................................................................................8 FIGURE 7: FIREBUG WITH FIREPHP AND XOOPS DEBUG MESSAGES ...........................................................................10 FIGURE 8: XOOPS DEBUG MESSAGES IN XOOPS........................................................................................................10 FIGURE 9: XOOPS DEBUG MESSAGES IN FIREBUG.......................................................................................................11 FIGURE 10: FIREBUG WITH DETAILED FIREPHP VARIABLE INFO ..................................................................................12
  • 4. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 4 of 12 XOOPS Documentation Team 1. INTRODUCTION As defined in Wikipedia, “Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another.” XOOPS is a complex PHP script, and therefore when new features are added, there is always a risk that they will introduce new bugs, or break some old code. Therefore debugging is a very important activity for every XOOPS developer. Note: for this tutorial as a Test Server we are using WAMP Server from: http://www.wampserver.com/, a free and Open Source web development environment on Windows. It allows you to create web applications with Apache, PHP and the MySQL database. It also comes with PHPMyAdmin to easily manage your databases. 2. DEBUGGING IN XOOPS XOOPS has three levels of debugging; PHP debug, MySQL debug and Smarty debug. If you suspect that your site may have faults there are several tools built into XOOPS that can help diagnose the problem. 2.1 PHP Debug The first is PHP Debug Mode that enables PHP errors to show on the screen. If PHP debug is not on, the system will suppress error messages coming from the PHP code. This is the main reason for the dreaded "Blank Page" problem, which is caused by an error in the PHP code, so serious that the interpretation of the code can no longer continue. Enabling PHP debug will often result in these blank pages showing an error message instead. 2.2 MySQL Debug The second tool is Mysql/Blocks Debug. This gives a popup out put of MySQL queries as well as other useful information. With this debugging setting enabled, a window will popup after each page load, showing the database queries, executed on the page. It will also show which blocks and templates are used on the page along with caching information (whether the block or template is cached) Faulty SQL queries will be highlighted in red with a MySQL error message appended 2.3 Smarty Debug The third tool built into Xoops is the Smarty Templates Debug mode. It is very useful not only for troubleshooting problems but also to assist in design of themes and templates. It shows the Smarty Variables and what they are assigned to on a given page. Smarty debug settings will open a new window on all pages using Smarty templates, showing all variables assigned to Smarty along with their values. This debug setting is useful if you know that there are no PHP errors, that the SQL queries execute successfully, but the information does not show up as expected. Quite often it is a matter of organising the information correctly for display which is only
  • 5. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 5 of 12 XOOPS Documentation Team discovered by looking at the actual values in each Smarty variable. An example is information in an array, which the template is coded to take from a sub-array instead - or vice versa. 2.4 Setting XOOPS Debugging As default, the Debug Mode is set to off. In order to activate Debug in XOOPS, please go to the menu: Preferences  System Options  General Settings: Figure 1: Selecting XOOPS General Settings This will open the General Settings form, where you can find the options for Debug Mode: Figure 2: Selecting Debug Mode Most of the time, we select the first option: “Enable debug (inline mode)”. Once this done, XOOPS will show all debug information at the bottom of the page: Figure 3: Control Admin Side
  • 6. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 6 of 12 XOOPS Documentation Team Figure 4: Front Side 2.4.1 Changing XOOPS Debug Mode directly in the database What to do when you don’t have access to the Admin to set the Debug mode there, e.g. when there are bugs that cause a “blank screen of death”? There are two ways to change the XOOPS Debug Mode: 1) You can do it directly in phpMyAdmin 2) You can run a MySQL query to UPDATE XXXX_config SET conf_value=YYYY WHERE conf_modid=0 AND conf_catid=1 AND conf_name='debug_mode' Replace XXXX with the value of XOOPS_DB_PREFIX in mainfile.php (default is "xoops"). Replace YYYY (Debug Mode) with: 0, for Off 1, for Debug Inline mode 2, for Debug in pop-up mode 3, for Smarty Template Debug 2.4.2 Setting Configuration Now the problem is that these messages will be visible to all users. But if we don’t want that, then XOOPS offers following configuration option, stored in /xoops_data/configs/xoopsconfig.php Just select the right debug level that you want by keeping the “0” or replacing it with “1” or “2”: /**#@+ * Debug level for XOOPS * * <ul>Displaying debug information to different level(s) of users: * <li> 0 - To all users</li> * <li> 1 - To members</li> * <li> 2 - To admins only</li> * </ul> */ /**#@-*/ "debugLevel" => 0,
  • 7. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 7 of 12 XOOPS Documentation Team 3. EXTERNAL DEBUGGING TOOLS 3.1 XDebug Xdebug is a PHP extension which provides debugging and profiling capabilities. The debug information that Xdebug can provide includes the following:  stack and function traces in error messages with: o full parameter display for user defined functions o function name, file name and line indications o support for member functions  memory allocation  protection for infinite recursions Xdebug also provides:  profiling information for PHP scripts[3]  code coverage analysis  capabilities to debug your scripts interactively with a debugger front-end.[4 If you use WAMP Server, it comes already with xDebug: Figure 5: WAMP Server To learn how to use xDebug, please read: http://devzone.zend.com/article/2803 3.2 Firebug Firebug (http://getfirebug.com/) is one of those tools that every Web developers should have in his toolbox. It integrates with Firefox as an extension, but it can be extended by itself, with many other ‘meta- extensions” available for it, like YSlow, FireCookie, PixelPerfect, and FirePHP, which is the main focus of this document. The main features of Firebug:
  • 8. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 8 of 12 XOOPS Documentation Team  Inspect HTML and modify style and layout in real-time  Use the most advanced JavaScript debugger available for any browser  Accurately analyze network usage and performance  Extend Firebug and add features to make Firebug even more powerful 3.3 FirePHP FirePHP is a Mozilla Firefox plugin/extension that merges with Firebug and enables you to log to your Firebug Console using a simple PHP method call. All data is sent via response headers and will not interfere with the content on your page, therefore it is ideally suited for AJAX development where clean JSON and XML responses are required. Issue these calls and this is what you will get in Firebug: Figure 6: FirePHP with messages in Firebug’s Console
  • 9. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 9 of 12 XOOPS Documentation Team 4. PHP DEBUGGING WITHOUT XOOPS 4.1 History Frankblack was frustrated with debugging his AJAX applications using just the standard Debug Mode, therefore he ended up using FireBug + FirePHP as addons for Firefox, and he rewrote XOOPS class/logger/render.php to output the XOOPS debug messages to FirePHP, resulting in a very flexible solution. Trabis contributed as well, and now we have a solution that is very helpful to XOOPS Developers. 4.2 Installation Important – you have to have Firefox to use Firebug and FirePHP! Recommended: Ver. 4.0 There are few simple steps to get you going: 1) Download and install in Firefox the newest version of Firebug (currently 1.7) from here: http://getfirebug.com/ 2) Download and install in Firefox the latest version of FirePHP extension: https://addons.mozilla.org/en-US/firefox/addon/firephp/ 3) Download and install the FireDebug 1.6 for XOOPS 2.5.x 4) Go to xoops_data/configs/xoopsconfig.php and change the DebugLogger configuration to: /**#@+ * Debug logger for XOOPS * * <ul>Choose logger to use * <li> legacy </li> * <li> pqp </li> * <li> firephp </li> * </ul> */ "debugLogger" => firephp, /**#@-*/ and you’re ready to go. 4.3 Using FirePHP/Firebug with XOOPS After installing the above tools, you can add this line your PHP file: require_once XOOPS_ROOT_PATH.'/class/logger/firephp/FirePHPCore/fb.php';
  • 10. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 10 of 12 XOOPS Documentation Team and you can start sending messages to FirePHP: FB::log('Log message'); FB::info('Info message'); FB::warn('Warn message'); FB::error('Error message'); FB::trace('Trace message'); Figure 7: Firebug with FirePHP and XOOPS debug messages The messages from XOOPS are coming from XOOPS Debug, but XOOPS just redirects them to Firebug, so you have all debug messages conveniently in one location. Figure 8: XOOPS Debug messages in XOOPS
  • 11. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 11 of 12 XOOPS Documentation Team Figure 9: XOOPS Debug messages in Firebug Additional advantage is that you also have Smarty Debug Output as well – all in one location. When we want to see values of variables, we can send it as well, e.g. FB::log($index_admin,'this is our ModuleAdmin class'); This will show in Firebug as: Since there is more information than the line can hold, we can just click on that line and a new window will open with all the details:
  • 12. XU-105 XOOPS Debugging with FirePHP/Firebug Last change: 2/13/2012 6:14 PM Page 12 of 12 XOOPS Documentation Team Figure 10: Firebug with detailed FirePHP variable info 4.4 Feedback This concludes our short tutorial on using FirePHP/Firebug in XOOPS. If you have any improvement suggestions, please post them in our Documentation Forums: http://xoops.org/modules/newbb/viewforum.php?forum=52