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

Bitcoin’s price fluctuations today are affected by many factors such as macroeconomics, policies, and market sentiment. Investors need to pay attention to technical and fundamental analysis to make informed decisions.

Gate.io has achieved the transformation from spot trading to on-chain ecosystem through MeMebox 2.0. 1) Build a cross-chain infrastructure and support the interoperability of 12 main chains; 2) Create a DeFi application ecosystem and provide one-stop services; 3) Implement incentive mechanisms and reconstruct value allocation.

Bitcoin’s price ranges from $20,000 to $30,000. 1. Bitcoin’s price has fluctuated dramatically since 2009, reaching nearly $20,000 in 2017 and nearly $60,000 in 2021. 2. Prices are affected by factors such as market demand, supply, and macroeconomic environment. 3. Get real-time prices through exchanges, mobile apps and websites. 4. Bitcoin price is highly volatile, driven by market sentiment and external factors. 5. It has a certain relationship with traditional financial markets and is affected by global stock markets, the strength of the US dollar, etc. 6. The long-term trend is bullish, but risks need to be assessed with caution.

The top ten virtual currency trading apps are: 1. OKX, 2. Binance, 3. gate.io, 4. Coinbase, 5. Kraken, 6. Huobi, 7. KuCoin, 8. Bitfinex, 9. Bitstamp, 10. Poloniex. Each platform has outstanding performance in trading products, user experience, security, etc., to meet the needs of different investors.

When choosing a compliant and secure Bitcoin trading platform, you need to evaluate its regulatory license, KYC/AML policies and security measures, and recommend three major platforms: Binance, OKX and gate.io.

Recommended reliable digital currency trading platforms: 1. OKX, 2. Binance, 3. Coinbase, 4. Kraken, 5. Huobi, 6. KuCoin, 7. Bitfinex, 8. Gemini, 9. Bitstamp, 10. Poloniex, these platforms are known for their security, user experience and diverse functions, suitable for users at different levels of digital currency transactions

Choose a reliable trading platform such as OKEx to ensure access to the official entrance.

The rankings of the top ten trading platforms in the cryptocurrency circle in 2025 are: 1. Binance, 2. OKX, 3. gate.io, 4. Huobi Global, 5. Coinbase, 6. Kraken, 7. Bitfinex, 8. KuCoin, 9. Bybit, 10. Bitstamp. These platforms stand out in the market for their security, transaction volume, user experience and innovation.
