FirePHP Debugging Guide_PHP Tutorial
For Web front-end debugging, Firebug is an indispensable debugging tool. It can monitor the network, monitor css and js errors, view DOM nodes, view how many A's the current page has received, and other functions.
PHP also has a tool that is as useful as firebug, and that is FirePHP.
FirePHP is a plug-in attached to firebug, which is used to debug PHP. The operation process is very simple. On the PHP side, use the PHP logging class library provided by FirePHP to output debugging information. On the browser side, use Firebug + FirePHP to receive and view the output debugging information. This debugging information will be directly attached to the returned HTTP header information. This information does not It will be displayed directly by the browser and will only be displayed in firephp, effectively achieving the problem of no conflict between debugging and page display. (Must use firefox browser)
FirePHP debugging principles
Through the server-side library FirePHPCore, and the Firebug-based plug-in FirePHP, PHP scripts can send debugging information to the browser through HTTP request headers. Once you set up FirePHP, you can get PHP script warnings and errors in Firebug's console, just like debugging JavaScript directly.
Installation
First, you need to install Firefox, Firebug, and FirePHP. It is recommended to use the latest versions of FireFox 19.0.2, Firebug 1.11.2, and FirePHP 0.7.1;
Secondly download the server-side library FirePHPCore:
> wget http://www.firephp.org/DownloadRelease/FirePHPLibrary-FirePHPCore-0.3.2
> file FirePHPLibrary-FirePHPCore-0.3.2
FirePHPLibrary-FirePHPCore-0.3.2: Zip archive data, at least v2.0 to extract
> unzip FirePHPLibrary-FirePHPCore-0.3.2
~/public_html/FirePHPCore-0.3.2> ls -R
.:
CHANGELOG CREDITS FirePHPCore-0.3.2 FirePHPLibrary-FirePHPCore-0.3.2 lib README test
./FirePHPCore-0.3.2:
CHANGELOG CREDITS lib README
./FirePHPCore-0.3.2/lib:
FirePHPCore
./FirePHPCore-0.3.2/lib/FirePHPCore: # For PHP5+, only use fb.php and FirePHP.class.php
fb.php fb.php4 FirePHP.class.php FirePHP.class.php4 LICENSE
./lib:
FirePHPCore
./lib/FirePHPCore:
fb.php fb.php4 FirePHP.class.php FirePHP.class.php4 LICENSE
./test: # Create a test directory in the unzipped directory for testing FirePHP
firephptest.php test
Next, create the test case firephptest.php in the test directory:
require_once '../lib/FirePHPCore/fb.php';
$firephp = FirePHP::getInstance(true);
$var = array(1, 2, 'hello world', array(1));
fb($var);
fb($var, 'Label'); Finally, visit www.domain.com/~zhanhailiang/FirePHPCore-0.3.2/test/firephptest.php in the browser, and you can see the following output on the console:
http://itravel.smartcom.cc/~zhanhailiang/FirePHPCore-0.3.2/test/firephptest.php
log: array('0'=>'1', '1'=>'2', '2'=> ... )
log: Label: array('0'=>'1', '1'=>'2', '2'=> ... ) You can see the response header details of the HTTP request through the Firebug network panel:
Connection close
Content-Encoding gzip
Content-Type text/html; charset=utf-8
Date Fri, 29 Mar 2013 01:39:32 GMT
Server nginx
Transfer-Encoding chunked
X-Wf-1-1-1-1 142|[{"Type":"LOG","File":"/home/zhanhailiang/public_html/FirePHPCore-0.3.2/test/firephptest.php","Line ":"8"},["1","2","hello world",["1"]]]|
X-Wf-1-1-1-2 158|[{"Type":"LOG","Label":"Label","File":"/home/zhanhailiang/public_html/FirePHPCore-0.3.2/test /firephptest.php","Line":"9"},["1","2","hello world",["1"]]]|
X-Wf-1-Index 2
X-Wf-1-Plugin-1 http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3
X-Wf-1-Structure-1 http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1
X-Wf-Protocol-1 http://meta.wildfirehq.org/Protocol/JsonStream/0.2 By analyzing the FirePHP opening and closing options, we can find that X-Wf-*** does not exist in the response information when FirePHP is closed. It can be found by analyzing HTTP requests,
When FirePHP is turned off, the HTTP request header is:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Cache-Control max-age=0
Connection keep-alive
Host itravel.smartcom.cc
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 When FirePHP is turned on, the HTTP request header is:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Cache-Control no-cache
Connection keep-alive
Host itravel.smartcom.cc
Pragma no-cache
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1
x-insight activate You can see that the difference in HTTP request headers when FirePHP is turned on is:
Pragma no-cache
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1
x-insight activate By viewing the FirePHP.class.php source code, you can see that FirePHPCore uses UA to determine whether the client has FirePHP installed:
/**
* Check if FirePHP is installed on client
*
* @return boolean
*/
Public function detectClientExtension()
{
// Check if FirePHP is installed on client via User-Agent header
If (@preg_match_all('/sFirePHP/([.d]*)s?/si',$this->getUserAgent(),$m) &&
version_compare($m[1][0],'0.0.6','>=')) {
return true;
} else
// Check if FirePHP is installed on client via X-FirePHP-Version header
If (@preg_match_all('/^([.d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) &&
version_compare($m[1][0],'0.0.6','>=')) {
return true;
}
return false;
}So is the x-insight request header useful? Looking at all the code in FirePHPCore, I didn't see the use of x-insight, so I guess x-insight has no actual use. In order to verify my guess, I used the FF extended HTTPRequester tool to simulate constructing a UA:FirePHP without x-insight request header. Test whether the response header is consistent with the response header containing the x-insight request:
GET http://itravel.smartcom.cc/~zhanhailiang/FirePHPCore-0.3.2/test/firephptest.php
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1
-- response --
200 OK
Server: nginx
Date: Fri, 29 Mar 2013 02:34:54 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
X-Wf-1-1-1-1: 142|[{"Type":"LOG","File":"/home/zhanhailiang/public_html/FirePHPCore-0.3.2/test/firephptest.php"," Line":"8"},["1","2","hello world",["1"]]]|
X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2
X-Wf-1-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3
X-Wf-1-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1
X-Wf-1-1-1-2: 158|[{"Type":"LOG","Label":"Label","File":"/home/zhanhailiang/public_html/FirePHPCore-0.3.2/ test/firephptest.php","Line":"9"},["1","2","hello world",["1"]]]|
X-Wf-1-Index: 2
Content-Encoding: gzip

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Binance Square is a social media platform provided by Binance Exchange, aiming to provide users with a space to communicate and share information related to cryptocurrencies. This article will explore the functions, reliability and user experience of Binance Plaza in detail to help you better understand this platform.

Ranking of the top ten digital virtual currency trading apps in 2025: 1. Binance: Leading the world, providing efficient transactions and a variety of financial products. 2. OKX: It is innovative and diverse, supporting a variety of transaction types. 3. Huobi: Stable and reliable, with high-quality service. 4. Coinbase: Be friendly for beginners and simple interface. 5. Kraken: The first choice for professional traders, with powerful tools. 6. Bitfinex: efficient trading, rich trading pairs. 7. Bittrex: Safety compliance, regulatory cooperation.

The latest download tutorial for Ouyi OKX6.118.0 version: 1. Click on the quick link in the article; 2. Click on the download (if you are a web user, please register the information first). The latest Android version v6.118.0 optimizes some functions and experiences to make trading easier. Update the app now to experience a more extreme trading experience.

In the cryptocurrency market, choosing a reliable trading platform is crucial. As a world-renowned digital asset exchange, the OK trading platform has attracted a large number of novice users in mainland China. This guide will introduce in detail how to register and use it on the OK trading platform to help novice users get started quickly.

As the world's leading cryptocurrency exchange, Binance is always committed to providing users with a safe and convenient trading experience. Over time, Binance has continuously optimized its platform features and user interface to meet the changing needs of users. In 2025, Binance launched a new login portal aimed at further improving the user experience.

In the cryptocurrency market, futures trading platforms play an important role, especially in perpetual contracts and options trading. Here are the top ten highly respected futures trading platforms in the market, and provide detailed introduction to their characteristics and advantages in perpetual contract and option trading.

According to the latest evaluations and industry trends from authoritative institutions in 2025, the following are the top ten cryptocurrency platforms in the world that support multi-chain transactions, combining transaction volume, technological innovation, compliance and user reputation comprehensive analysis:

The latest download tutorial for Ouyi OKX6.118.0 version: 1. Click on the quick link in the article; 2. Click on the download (if you are a web user, please register the information first). The latest Android version v6.118.0 optimizes some functions and experiences to make trading easier. Update the app now to experience a more extreme trading experience.
