*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/**
* \file htdocs/admin/system/xdebug.php
* \brief Page administration XDebug
*/
require '../../main.inc.php';
$langs->load("admin");
if (!$user->admin)
accessforbidden();
/*
* View
*/
llxHeader();
print_fiche_titre("XDebug",'','title_setup');
print "
\n";
if (!function_exists('xdebug_is_enabled'))
{
print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.';
llxFooter();
exit;
}
if (function_exists('socket_create'))
{
$address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1';
$port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000;
print "Current xdebug setup:
\n";
print "* Remote debug setup:
\n";
print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."
\n";
print 'xdebug.remote_host = '.$address."
\n";
print 'xdebug.remote_port = '.$port."
\n";
print "* Profiler setup ";
if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)";
else print "(currenlty not available)";
print ":
\n";
print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."
\n";
print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."
\n";
print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."
\n";
print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."
\n";
print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."
\n";
print "
\n";
echo "To run a debug session, add parameter
";
echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.
\n";
echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter
\n";
echo "* XDEBUG_PROFILE=aname on each URL.
";
print "
";
print "Test debugger server (Eclipse for example):
\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (empty($socket)) die('Unable to prepare a socket');
//socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port);
//socket_listen($sock);
//$client = socket_accept($sock);
$client=socket_connect($socket, $address, $port);
if ($client)
{
echo "Connection established: ".$client." - address=".$address." port=".$port."
\n";
echo "There is a Remote debug server at this address.
\n";
echo "
\n";
echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n";
echo "your php.ini file with this :
\n";
echo '\n";
print "
\n";
echo 'Then check in your debug server (Eclipse), you have setup:
XDebug with same port than in php.ini
Allow Remote debug=yes or prompt
'."\n";
print "
\n";
}
else
{
print socket_strerror(socket_last_error());
echo "Failed to connect to address=".$address." port=".$port."
\n";
echo "There is no Remote debug server at this address.\n";
}
socket_close($socket);
}
else
{
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
}
llxFooter();
$db->close();