php debug Chromephp htaccess, php.ini or firephp:

Jul 18, 01:25 AM

UPDATE – in this file: /home/comptonpeslonline.com/etc/php.ini 2015-05-23
SET THIS: error_log = etc-php-ini-php_errors.log 2015-05-23

PHP UPDATE – 2014-12-08:
.htaccess file: (MAKE SURE THIS IS FIRST FOR WORDPRESS)
php_flag log_errors on
php_flag display_errors off
php_value error_reporting 6143

the error-log will appear in the /home/DOMAINNAME.COM/error_log file – not sure why its not appearing here anymore:
php_value error_log /var/www/blah/blah/blah/marks-php-error.log
END PHP UPDATE – 2014-12-08

javascript: include this line:

debugger;

when breakpoints quit working for whatever reason. 2013-12-23

== PhpConsole:

require_once(‘PhpConsole/PhpConsole.php’);
PhpConsole::start();
debug(‘test message’);
debug($_SERVER[“SERVER_ADDR”]);
debug(‘SELECT * FROM users’, ‘sql’);
unkownFunction($unkownVar);

==Chromephp (cant get it to work anymore 2013-06-17)

include ‘ChromePhp.php’;
ChromePhp::log(‘hello world’);
ChromePhp::log($_SERVER);

==firephp:

require_once(’/usr/lib/php/FirePHPCore-0.3.2/lib/FirePHPCore/FirePHP.class.php’);
require_once(’/usr/lib/php/FirePHPCore-0.3.2/lib/FirePHPCore/fb.php’);
ob_start();
$firephp = FirePHP::getInstance(true); //non-global
$GLOBALS[‘firephp’] = FirePHP::getInstance(true);

$GLOBALS[‘firephp’]->log($var, ‘Variables’);
$GLOBALS[‘firephp’]->log($_GET);

=== htaccess or php.ini
in order to use php error logs, you first have to determine which of these methods will work: php.ini or .htaccess

custom local php.ini method:


cat > /home/edwardsmarkf/public_html/php.ini ;
log_errors = 1
display_errors = 1
error_log = /home/edwardsmarkf/public_html/marks-error-file

.htaccess method:


create a file called .htaccess and add these lines:

php_flag log_errors on
php_value error_log /var/www/blah/blah/blah/marks-php-error.log
php_flag display_errors off
php_value error_reporting 6143

the error-log will appear in the php-error.log file


another option:
php xdebug – added more information about where the program is inside of subroutines – 2009-01-14

= C O O L D E B U G T R I C K ==========

error_log( ‘log this please’ ); // cool debug trick!

dump the contents of $_REQUEST to the error log in readable format:
error_log(print_r($_REQUEST, 1));

to dump the contents of phpinfo() to a log file: 2013-02-05
ob_start();
phpinfo();
$variable = ob_get_contents();
ob_get_clean();

to determine the location of script in http environment:
$whole_script_name = $_SERVER[“SCRIPT_FILENAME”];
// $whole_script_name=’/var/www/html/newFlashMenuTest/phpinfo.php’;
$pattern = ‘?(/.*/).*$?’;
$replace=‘this—->$1’;
echo preg_replace($pattern, $replace, $whole_script_name) ;

Mark Edwards

,

---

Commenting is closed for this article.

---