EzDevInfo.com

chromephp

class for logging PHP variables to Google Chrome console Chrome Logger - Server side application debugging a google chrome extension for debugging server side applications in the chrome console.

Remove FirePHP headers with Varnish

I've got a line in my Varnish default.vcl that successfully clears the ChromePHP headers:

sub vcl_fetch {
    remove beresp.http.X-ChromeLogger-Data;
}

I'm trying to do the same thing for FirePHP, but the data for FirePHP is spread out over many headers rather than all in one:

  • X-Wf-Protocol-1
  • X-Wf-1-Plugin-1
  • X-Wf-1-1-1-9
  • X-Wf-1-1-1-43
  • etc

How can I tell Varnish to remove any headers that start with "X-Wf-"? I can't find any documentation that includes a wildcard for the header name.


Source: (StackOverflow)

How to log arrays with ChromePhp Logger

Hi all I have the ChromePhp logging extension set up with PhpConsole and it's working fine.

But the usual ChromePhp::log("Variable value: ".$variable) doesn't like having $variable as an array. It throws an array to string conversion error.

Is there an in-built method to log the array in human readable format, just like javascript's console.log(array). Or is it a case of iterating over the array and passing each index and value.


Source: (StackOverflow)

Advertisements

Warning: Cannot modify header information - headers already sent when using ChromePhp.php [duplicate]

This question already has an answer here:

I wish to peek into my PHP code to see what is going on to help me rectify some issues. The PHP code is for processing the data from a form. I have tried Chrome Logger http://craig.is/writing/chrome-logger but I can't get it to send me any messages to the browser consloe.

I have built a simple test case:

file ChromeLoggerTest.html

<html>
<body>
<?php include './scripts/ChromeLoggerTest.php';?>
<p>Hi from ChromeLoggerTest.html</p>
</body>
</html>

file ChromeLoggerTest.php

<?php
include 'ChromePhp.php';
$theDate = date("l jS \of F Y h:i:s A");
ChromePhp::log("Hello console using ChromePhp::log from ChromeLoggerTest.php.  The date is: $theDate");
ChromePhp::warn("Hello console using ChromePhp::warn from ChromeLoggerTest.php.  The date is: $theDate");
echo "<p>Hello Browser from ChromeLoggerTest.php. Welcome to my php file to test Chrome Logger.  The date is $theDate </p>";
?>

If I type ChromeLoggerTest.html into the browser address bar I obtain in the browser window:

Warning: Cannot modify header information - headers already sent by (output started at /home/d50364/public_html/ChromeLoggerTest.html:3) in /home/d50364/public_html/scripts/ChromePhp.php on line 394

Warning: Cannot modify header information - headers already sent by (output started at /home/d50364/public_html/ChromeLoggerTest.html:3) in /home/d50364/public_html/scripts/ChromePhp.php on line 394 Hello Browser from ChromeLoggerTest.php. Welcome to my php file to test Chrome Logger. The date is Thursday 13th of November 2014 12:35:07 PM

Hi from ChromeLoggerTest.html

There is no output in the console. If I comment out the ChromePhp lines in the PHP file then the errors go away but I do not get any output in the console.

If I type scripts/ ChromeLoggerTest.php into the brwoser address bar I obtain in the browser window and browser console:

Browser:

Hello Browser from ChromeLoggerTest.php. Welcome to my php file to test Chrome Logger. The date is Thursday 13th of November 2014 12:47:13 PM

Browser console:

Hello console using ChromePhp::log from ChromeLoggerTest.php. The date is: Thursday 13th of November 2014 12:47:13 PM Hello console using ChromePhp::warn from ChromeLoggerTest.php. The date is: Thursday 13th of November 2014 12:47:13 PM

Reading on Stackoverflow there are suggestions about using ob_start(); and ob_flush(); these have not solved my problem.

There are also suggestions that the issue might be caused by whitespace in the files. I have edited them to a single line each and this has not solved my problem.

I have verified that the files are saved without BOM.

Some relevant links:

Warning: Cannot modify header information - headers already sent by ERROR

How to fix "Headers already sent" error in PHP

https://www.geeklog.net/faqman/index.php?op=view&t=38

Setting Up ChromePhp For Wordpress Using Xampp

https://wordpress.org/support/topic/error-cannot-modify-header-information-2

https://github.com/ccampbell/chromephp/issues/15

https://github.com/ccampbell/chromephp

Thank you for taking the time to read this. Any assistance gratefully received.


Source: (StackOverflow)

Can't use ChromePHP and FirePHP at the same time

I want to use ChromePHP and FirePHP. Separate calls work perfect, but when I call them at the same time like this

ChromePhp::log($var);
FB::log($var);

I have server error.

I've searched for solution and found this: https://github.com/zendframework/zf2/issues/6060, but I can't understand what is wrong. What should I do to deal with it?


Source: (StackOverflow)

Log from inside php functions using ChromeLogger and ChromePHP

I'm making a foray into php (wordpress) and have set up ChromeLogger (http://craig.is/writing/chrome-logger) and ChromePHP (https://github.com/ccampbell/chromephp).

I can now log ok from my templates, but i'd really like to be able to log to the console from inside php functions too (like in js), which is very useful for debugging. In this case my function is in

mywordpressfolder/wp-content/themes/mytheme/functions.php

Like i say i'm new to php and am not sure how it all fits together with the browser and whether this is possible. Is it? If so, how?

thanks, max


Source: (StackOverflow)