Debugging
From b2evolution manual
(Added script to debug Permissions) |
(Add section about $debug_xmlrpc_logging) |
||
| Line 2: | Line 2: | ||
To have a '''Debuglog''' with a load of information on the bottom of each page, set | To have a '''Debuglog''' with a load of information on the bottom of each page, set | ||
$debug = 1; | $debug = 1; | ||
| - | in /conf/_advanced.php. | + | in <tt>/conf/_advanced.php</tt>. |
| + | |||
| + | === Enable logging of XMLRPC === | ||
| + | To debug communication between a blogging tool which uses the XMLRPC interface, you can set | ||
| + | $debug_xmlrpc_logging = 1; | ||
| + | in <tt>/conf/_advanced.php</tt>. | ||
| + | This will log to the file `/xmlsrv/xmlrpc.log` then and will be helpful when debugging what's going on or why a particular request fails. | ||
| + | |||
| + | ''You may also want to test against the latest code by using <tt>http://test.b2evo.net/HEAD/xmlsrv/xmlrpc.php</tt> (login: <tt>admin</tt>, password: <tt>demopass</tt>).'' | ||
== Blank pages == | == Blank pages == | ||
| Line 20: | Line 28: | ||
Often additional information may be useful/required. | Often additional information may be useful/required. | ||
| - | + | Therefore you can setup a simple file in your web root directory like so: | |
<?php | <?php | ||
phpinfo(); | phpinfo(); | ||
Revision as of 10:53, 3 February 2010
Contents |
Enable Debuglog
To have a Debuglog with a load of information on the bottom of each page, set
$debug = 1;
in /conf/_advanced.php.
Enable logging of XMLRPC
To debug communication between a blogging tool which uses the XMLRPC interface, you can set
$debug_xmlrpc_logging = 1;
in /conf/_advanced.php. This will log to the file `/xmlsrv/xmlrpc.log` then and will be helpful when debugging what's going on or why a particular request fails.
You may also want to test against the latest code by using http://test.b2evo.net/HEAD/xmlsrv/xmlrpc.php (login: admin, password: demopass).
Blank pages
Blank pages or sudden script abortion often mean that there's a fatal error during the PHP script execution and the website/server is configured to not display them.
A cause for this might be a parse error or the exhaustion of the memory limit).
You can try to look into the server's error log or add the following code to /conf/_basic_config.php (/conf/_config.php before b2evo 1.8):
ini_set( 'error_reporting', E_ALL ); /* report all errors */ ini_set( 'display_errors', 'on' ); /* display them on the page */
Add this after the opening "<?php" tag at the beginning of the page.
Note that this won't help, if you have a parse error in the config file you're editing itself, because PHP cannot execute the statements that change the reporting..
phpinfo
Often additional information may be useful/required.
Therefore you can setup a simple file in your web root directory like so:
<?php phpinfo(); ?>
Save this as p.php and give the URL to that file to the developer that asks for it or mention it in your bug report.
E.g., you can search on the resulting page for "safe_mode" to see if your installation is setup like so.
Permissions
If you have file permission problems, try the following script. Upload it into your "blogs" directory, where "media" is and call it from a browser. It will display a recursive list of the subdirectories in "media" and display info about the permissions that apply to each directory (including and especially user/group permissions).
<?php
$dir = dirname(__FILE__).'/media/';
#$dir = '';
echo 'Current script owner (irrelevant): '.get_current_user();
echo "<br />\n";
$processUser = posix_getpwuid(posix_geteuid());
echo 'Process user:'.$processUser['name'];
echo "<br />\n";
echo '<h1>Dirs:</h1>';
?>
<p>
Effective perms are <strong>highlighted/bold</strong>.
<br />
<span style="color:green">Green</span> user and groupnames can write.<br />
<span style="color:brown">Brown</span> user and groupnames can read.<br />
<span style="color:red">Red</span> user and groupnames cannot read/write.<br />
</p>
<?php
echo '<ul>';
print_dir_owners($dir);
echo '</ul>';
function print_dir_owners($dir)
{
$uid = fileowner( $dir );
$gid = filegroup( $dir );
if( function_exists('posix_getpwuid') )
{
$user = posix_getpwuid($uid);
$user = $user['name'];
$group = posix_getpwuid($gid);
$group = $group['name'];
}
else
{
$user = '#'.$uid;
$group = '#'.$gid;
}
$perms = substr( sprintf('%o', fileperms($dir)), -3 );
echo '<li>'.$dir.":<br />\n";
for( $i = 0; $i < strlen($perms); $i++ )
{
$highlight = false;
switch($i)
{
case 0:
if( $uid == posix_geteuid() )
$highlight = true;
break;
case 1:
if( $gid == posix_geteuid() )
$highlight = true;
break;
case 2:
$highlight = true;
break;
}
if( $highlight )
echo '<strong>'.$perms{$i}.'</strong>';
else
echo $perms{$i};
}
echo ' / ';
echo '<span style="color:';
if( $perms{0} < 4 )
echo 'red';
elseif($perms{0} < 6)
echo 'brown';
else
echo 'green';
echo '">'.$user.'</span>';
echo '/<span style="color:';
if( $perms{1} < 4 )
echo 'red';
elseif($perms{1} < 6)
echo 'brown';
else
echo 'green';
echo '">'.$group.'</span>';
if( ($dh = dir($dir)) !== false )
{
echo '<ul>';
while( $entry = $dh->read() )
{
if( $entry == '.' || $entry == '..' )
continue;
if( is_dir($dir.$entry) )
{
print_dir_owners($dir.$entry.'/');
}
}
echo '</ul>';
}
echo '</li>';
}
?>
