i have a problem during the debugging of php pages.
When i set a breakpoint, the debugger stop on the line, but when i click f8, f7, or f5 to continue, debugger crashes.
Then i see in output, on browser just what was sent before the breakpoint.
If i not set a breakpoint, the page is comlpetely processed correctly.
i'm using:
Kubuntu 16.04
xdebug 2.4.0
PHP Version 7.0.8-3+deb.sury.org~xenial+1
netbeans 8.1
this is my xdebug section in php.ini
[XDebug]
zend_extension = "/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.profiler_output_dir="\tmp"
xdebug.idekey=XDEBUG_IDEKEY
xdebug.remote_autostart=1
xdebug.collect_params=1
xdebug.remote_host=localhost
xdebug.remote_mode=req
xdebug.remote_handler=dbgp
xdebug.remote_connect_back=1
xdebug.max_nesting_level=200
xdebug.var_display_max_depth=1000
xdebug.var_display_max_children=256
xdebug.var_display_max_data=4096
request_terminate_timeout=600s
i tried several different configuration in php.ini, always the same problem.
If ipaste my phpinfo() in https://xdebug.org/wizard.php
the result is:
You're already running the latest Xdebug version
Does anyone have any idea?
Edit.
I added an error handler; that print this output:
Error: [8] Undefined variable: resq - xdebug://debug-eval:1
Terminating PHP Script
And inside the error handler i call:
debug_print_backtrace();
that print:
#0 handleError(8, Undefined variable: resq, xdebug://debug-eval, 1, Array ([_GET] => Array ([XDEBUG_SESSION_START] => netbeans-xdebug),[_POST] => Array (),[_COOKIE] => Array ([__utma] => 111872281.1893580102.1409742196.1409912396.1409912582.6,[_ga] => GA1.1.1893580102.1409742196,[HstCfa2834198] => 1442332630459,[HstCla2834198] => 1442821794939,[HstCmu2834198] => 1442332630459,[HstPn2834198] => 15,[HstPt2834198] => 51,[HstCnv2834198] => 5,[HstCns2834198] => 10),[_FILES] => Array (),[_ENV] => Array (),[_REQUEST] => Array ([XDEBUG_SESSION_START] => netbeans-xdebug),[_SERVER] => Array ([HTTP_HOST] => localhost,[HTTP_USER_AGENT] => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0,[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.5,[HTTP_ACCEPT_ENCODING] => gzip, deflate,[HTTP_COOKIE] => __utma=111872281.1893580102.1409742196.1409912396.1409912582.6; _ga=GA1.1.1893580102.1409742196; HstCfa2834198=1442332630459; HstCla2834198=1442821794939; HstCmu2834198=1442332630459; HstPn2834198=15; HstPt2834198=51; HstCnv2834198=5; HstCns2834198=10,[HTTP_CONNECTION] => keep-alive,[PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin,[SERVER_SIGNATURE] =>
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
,[SERVER_SOFTWARE] => Apache/2.4.18 (Ubuntu),[SERVER_NAME] => localhost,[SERVER_ADDR] => 127.0.0.1,[SERVER_PORT] => 80,[REMOTE_ADDR] => 127.0.0.1,[DOCUMENT_ROOT] => /var/www/html,[REQUEST_SCHEME] => http,[CONTEXT_PREFIX] => ,[CONTEXT_DOCUMENT_ROOT] => /var/www/html,[SERVER_ADMIN] => webmaster#localhost,[SCRIPT_FILENAME] => /var/www/html/fierart/index.php,[REMOTE_PORT] => 36736,[GATEWAY_INTERFACE] => CGI/1.1,[SERVER_PROTOCOL] => HTTP/1.1,[REQUEST_METHOD] => GET,[QUERY_STRING] => XDEBUG_SESSION_START=netbeans-xdebug,[REQUEST_URI] => /fierart/index.php?XDEBUG_SESSION_START=netbeans-xdebug,[SCRIPT_NAME] => /fierart/index.php,[PHP_SELF] => /fierart/index.php,[REQUEST_TIME_FLOAT] => 1467579745.269,[REQUEST_TIME] => 1467579745))) called at [xdebug://debug-eval:1] #1 unknown() called at [/var/www/html/fierart/index.php:24]
thank you for helping.
I solved finding this topic
Call to a member function getAction() on a non-object
Problem was the same:
"I had an expression in my watch list i wasn't using anymore"
Related
My executable (C++ compiled with Visual Studio) communicates with the PHP webserver to submit data via POST. It worked as designed for years but suddenly stopped working correctly in January 2023. The only change which may happen is an upgrade of the webserver to PHP-8, and a regular Windows update, which changed WININET.DLL used by executable to send HTTP requests.
I am using the code like this (with my variables appropriately defined):
HINTERNET hSession = InternetOpen( “lpszAgent”, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetConnect( hSession, “server.XXX.com”, INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
LPCSTR FAR* rgpszAcceptTypes = { _T("*/*"), NULL };
HINTERNET hRequest = HttpOpenRequest( hConnect, "POST", “path_to_script.php”, NULL, NULL, rgpszAcceptTypes, 0, NULL);
LPCSTR lpszHeaders = "Content-Type: application/x-www-form-urlencoded";
DWORD dwHeadersLength = strlen(lpszHeaders);
LPCSTR pfrmdata = "a=b&etc";//correctly encoded
DWORD dwOptionalLength = strlen(pfrmdata);
bool ok = HttpSendRequest(hRequest, lpszHeaders, dwHeadersLength, (void*)pfrmdata, dwOptionalLength);
Everything works without any errors. However, on the server side, I get an empty POST and the following headers:
SERVER:
array (
'LSPHP_ENABLE_USER_INI' => 'on',
'PATH' => '/usr/local/bin:/usr/bin:/bin',
'TEMP' => '/tmp',
'TMP' => '/tmp',
'TMPDIR' => '/tmp',
'PWD' => '/',
'HTTP_ACCEPT' => '*/*',
'HTTP_CONNECTION' => 'Keep-Alive',
'CONTENT_LENGTH' => '0',
'HTTP_HOST' => ‘Correct ',
'HTTP_USER_AGENT' => 'Correct',
'HTTP_CACHE_CONTROL' => 'no-cache',
'REDIRECT_UNIQUE_ID' => 'Y82i1YUhgzjQfeXqYUTbfQAAAH8',
'REDIRECT_QS_SrvConn' => '70',
'REDIRECT_QS_AllConn' => '75',
'REDIRECT_QS_ConnectionId' => '167442094953986927446367',
'REDIRECT_HTTPS' => 'on',
'REDIRECT_SSL_TLS_SNI' => 'Correct',
'REDIRECT_STATUS' => '200',
'UNIQUE_ID' => 'Y82i1YUhgzjQfeXqYUTbfQAAAH8',
'QS_SrvConn' => '70',
'QS_AllConn' => '75',
'QS_ConnectionId' => '167442094953986927446367',
'HTTPS' => 'on',
'SSL_TLS_SNI' => 'Correct',
'SERVER_SIGNATURE' => '',
'SERVER_SOFTWARE' => 'Apache',
'SERVER_NAME' => 'Correct ',
'SERVER_ADDR' => 'Correct',
'SERVER_PORT' => '443',
'REMOTE_ADDR' => 'Correct',
'DOCUMENT_ROOT' => 'Correct',
'REQUEST_SCHEME' => 'https',
'CONTEXT_PREFIX' => '',
'CONTEXT_DOCUMENT_ROOT' => 'Correct',
'SERVER_ADMIN' => 'Correct',
'SCRIPT_FILENAME' => 'Correct',
'REMOTE_PORT' => '8700',
'REDIRECT_URL' => 'Correct',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'GET',
'QUERY_STRING' => '',
'REQUEST_URI' => 'Correct',
'SCRIPT_NAME' => 'Correct',
'PHP_SELF' => 'Correct',
'REQUEST_TIME_FLOAT' => 1674420950.062037944793701171875,
'REQUEST_TIME' => 1674420950,
'argv' =>
array (
),
'argc' => 0,
)
As you may see CONTENT_LENGTH=0 and CONTENT_TYPE is absent at all, while it should be “application/x-www-form-urlencoded”, and REQUEST_METHOD is GET instead of POST.
I understand that CONTENT_TYPE is essential. If it is not there then POST data is not read, REQUEST_METHOD becomes GET, and CONTENT_LENGTH becomes zero and my data submitted consequently ignored by the server.
So, the problem is that CONTENT_TYPE has disappeared from the request. But why? What is wrong now? Please, recall that it used to all work just fine before January 2023.
I tried to downgrade PHP to 7.4 - it did not help.
I put my script on a different server under a site which uses PHP 7.4 - it started working!
I made a new test site on the other server with the latest PHP 8.2 - it does not work.
Downgraded PHP 8.2 to PHP 7.4 - still did not help.
I installed a new test site on other server and set PHP 7.4 during the installation - it now works!
I upgaded it to PHP 8.2 - stopped working.
I downgraded back to PHP 7.4 - still does not work.
Could this have been more confusing? I beg you to give me some ideas. Thank you!
Update:
Thank you so much for all the comments. Indeed, it must be a redirection of HTTP to HTTPS at fault. The hosting provider (Hostmonster) has recently installed free SSL certificates to all the domains and made all domains use HTTPS. They think they have done a great job and refuse to understand my problem. My executable still works via HTTP, and the redirection breaks it. I am failing to explain to them what I need at the level of support I get from them. They think it all works great and advise me to hire a developer :) They do not seem to provide an option to stop redirection.
I think, I should be able to disable their server-wide redirection from the local .htaccess file. But I am not sure how to do that. I guess, I need to see which method they used to enable it, but I could not figure out how to see the Apache configuration for my domain/location on a shared server.
Could you guess which lines in the local .htaccess would possibly disable the automatic redirection from HTTP to HTTPS?
I'm using Laravel with Oracle connection, so I set up OCI8 for Yajra.
After setting all of the requirements. (Instantclient, OCI8, Enviroment ...)
I have checked the php -ini command.
And the result like this: (it means OCI8 is installed successfully, right?)
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.2.0
Oracle Run-time Client Library Version => 12.2.0.1.0
Oracle Compile-time Instant Client Version => 12.2
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
But when using phpinfo(), there's no OCI8
I have tried to test the connection by this code
<?php
$db = "(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=My IP)
(PORT=1521)
)
(CONNECT_DATA=
(SERVICE_NAME=SID)
)
)" ;
if($c = OCILogon("my user", "my pass", $db))
{
echo "Successfully connected to Oracle.\n";
OCILogoff($c);
}
else
{
$err = OCIError();
echo "Connection failed." . $err[text];
}
?>
And it returned HTTP ERROR 500.
Maybe I have mistaken on something? Please help, it's take me more than 2 days to solve it.
Thanks in advance
I have installed oci8 in my server. Enabled the extension in php.ini. When I run php --ri oci8 I get
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php.ini on line 737 in Unknown on line 0
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.0.8
Revision => $Id: f04114d4d67cffea4cdc2ed3b7f0229c2caa5016 $
Oracle Run-time Client Library Version => 12.2.0.1.0
Oracle Compile-time Instant Client Version => 12.2
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
Statistics =>
Active Persistent Connections => 0
Active Connections => 0
When I run php --rf oci_connect
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php.ini on line 737 in Unknown on line 0
Function [ <internal:oci8> function oci_connect ] {
- Parameters [5] {
Parameter #0 [ <required> $username ]
Parameter #1 [ <required> $password ]
Parameter #2 [ <optional> $connection_string ]
Parameter #3 [ <optional> $character_set ]
Parameter #4 [ <optional> $session_mode ]
}
}
But when I try to run my application I get Call to undefined function oci_connect()
It's an error in MyBB, after install I get this error from the index:
Warning: require_once(./global.php): failed to open stream: No such file or directory in C:\jws\htdocs\index.php on line 18
Fatal error: require_once(): Failed opening required './global.php' (include_path='.;C:\php\pear') in C:\jws\htdocs\index.php on line 18
Index code near top:
require_once './global.php';
require_once MYBB_ROOT.'inc/functions_forumlist.php';
require_once MYBB_ROOT.'inc/class_parser.php';
The file is there, I checked in the folder. I haven't changed anything in the files. I'm using PHP 5.6.4, and the index file is loaded from a require_once in another file.
Here:
<?php
$_SERVER = array(
"SERVER_PROTOCOL" => "HTTP/1.1","DOCUMENT_ROOT" => "C:/jws/htdocs","REMOTE_ADDR" => "127.0.0.1","REQUEST_URI" => "/","SERVER_SOFTWARE" => "JWS/1.0","argv" => "","REQUEST_TIME" => "Tue, 30 Dec 2014 12:33:14 PST","PHP_SELF" => "/","REMOTE_PORT" => "56601","REQUEST_METHOD" => "GET","SCRIPT_NAME" => "","SERVER_NAME" => "JWS/1.0","PATH_INFO" => "","ORIG_PATH_INFO" => "","argc" => "","GATEWAY_INTERFACE" => "N/I","SERVER_PORT" => "80","SCRIPT_FILENAME" => "C:/jws/htdocs/index.php","HTTP_ACCEPT_LANGUAGE" => "en-US,en;q=0.5","HTTP_HOST" => "127.0.0.1","QUERY_STRING" => "","REQUEST_TIME_FLOAT" => "1419971594194","HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0","HTTP_ACCEPT_ENCODING" => "gzip, deflate","SERVER_ADDR" => "127.0.0.1","HTTP_CONNECTION" => "keep-alive",
);
$_GET = array(
);
$_POST = array(
);
$_COOKIE = array(
);
$_REQUEST = array(
);
require_once 'C:/jws/htdocs/index.php';
?>
replace your index code with this
require_once 'global.php';
require_once MYBB_ROOT.'inc/functions_forumlist.php';
require_once MYBB_ROOT.'inc/class_parser.php';
I managed to use:
chdir("the path");
to change the working directory, and I also had issues with redirection failure in the server.
Thanks for the help!
index.php code near top:
<?PHP
require_once MYBB_ROOT.'/global.php';
require_once MYBB_ROOT.'/inc/functions_forumlist.php';
require_once MYBB_ROOT.'/inc/class_parser.php';
?>
indexTest.php
<?php
define("MYBB_ROOT", __DIR__);
$_SERVER = array(
"SERVER_PROTOCOL" => "HTTP/1.1","DOCUMENT_ROOT" => "C:/jws/htdocs","REMOTE_ADDR" => "127.0.0.1","REQUEST_URI" => "/","SERVER_SOFTWARE" => "JWS/1.0","argv" => "","REQUEST_TIME" => "Tue, 30 Dec 2014 12:33:14 PST","PHP_SELF" => "/","REMOTE_PORT" => "56601","REQUEST_METHOD" => "GET","SCRIPT_NAME" => "","SERVER_NAME" => "JWS/1.0","PATH_INFO" => "","ORIG_PATH_INFO" => "","argc" => "","GATEWAY_INTERFACE" => "N/I","SERVER_PORT" => "80","SCRIPT_FILENAME" => "C:/jws/htdocs/index.php","HTTP_ACCEPT_LANGUAGE" => "en-US,en;q=0.5","HTTP_HOST" => "127.0.0.1","QUERY_STRING" => "","REQUEST_TIME_FLOAT" => "1419971594194","HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0","HTTP_ACCEPT_ENCODING" => "gzip, deflate","SERVER_ADDR" => "127.0.0.1","HTTP_CONNECTION" => "keep-alive",
);
$_GET = array(
);
$_POST = array(
);
$_COOKIE = array(
);
$_REQUEST = array(
);
require_once MYBB_ROOT.'/index.php';
?>
I am new to PHP and got confused, I wrote a PHP script to log the server environment variables when user make request, and my code looks like this:
<?php
$req_dump = print_r($_SERVER, TRUE);
$fp = fopen('/tmp/request.log', 'a');
fwrite($fp, $req_dump);
fclose($fp);
echo "hello world";
However, the output looks like below:
Array
(
[HTTP_USER_AGENT] => anaconda/13.21.195
[HTTP_HOST] => 10.0.188.97
[HTTP_ACCEPT] => */*
[HTTP_X_ANACONDA_ARCHITECTURE] => x86_64
[HTTP_X_ANACONDA_SYSTEM_RELEASE] => Red Hat Enterprise Linux
[HTTP_X_RHN_PROVISIONING_MAC_0] => eth0 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_1] => eth1 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_2] => eth2 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_3] => eth3 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_4] => eth4 00:02:C9:4F:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_5] => eth5 00:02:C9:4F:xx:xx
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin
[SERVER_SIGNATURE] => <address>Apache/2.2.15 (Red Hat) Server at 10.0.188.97 Port 80</address>
[SERVER_SOFTWARE] => Apache/2.2.15 (Red Hat)
[SERVER_NAME] => 10.0.188.97
[SERVER_ADDR] => 10.0.188.97
[SERVER_PORT] => 80
[REMOTE_ADDR] => 10.0.188.212
[DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => root#localhost
[SCRIPT_FILENAME] => /var/www/html/ks.php
[REMOTE_PORT] => 59188
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /ks.php/images/install.img
[SCRIPT_NAME] => /ks.php
[PATH_INFO] => /images/install.img
[PATH_TRANSLATED] => /var/www/html/images/install.img
[PHP_SELF] => /ks.php/images/install.img
[REQUEST_TIME] => 1402439673
)
How I tried to access the array:
FYI, here is the code how I tried to access that array:
# ks.php
<?php
$Table = array(
"00:02:C9:10:aa:bb" => "10.0.188.91",
"00:02:C9:4F:aa:bb" => "10.0.188.92",
"00:02:C9:53:aa:bb" => "10.0.188.93",
"00:02:C9:56:aa:bb" => "10.0.188.94",
"00:02:C9:53:aa:bb" => "10.0.188.95",
"00:02:C9:4E:aa:bb" => "10.0.188.96",
"00:02:C9:5A:aa:bb" => "10.0.188.97",
);
?>
...
%post
...
printf 'DEVICE=eth4 \nIPADDR=<?php echo $Table[$_SERVER["HTTP_X_RHN_PROVISIONING_MAC_4"]]; ?>' > /etc/sysconfig/network-scripts/ifcfg-eth4
service network restart
...
%end
The output doesn't look like straight forward to me. Say I want to get the MAC address of ethernet4, and $_SERVER["HTTP_X_RHN_PROVISIONING_MAC_4"] doesn't work for me.
Can anyone help me explain how to achieve that in PHP?
your $_SERVER['HTTP_X_RHN_PROVISIONING_MAC_4'] output is eth4 00:02:C9:4F:xx:xx which also has a prefix eth4 where as your $Table has 00:02:C9:4F:aa:bb which makes the keys mismatch and actually you are trying to get $Table['eth4 00:02:C9:4F:xx:xx'] which is non existent in your $Table array
Try this:
// We are splitting the mac address by space so that $macAddress contains '00:02:C9:4F:xx:xx' and $eth contains eth4
list($eth,$macAddress) = explode(' ',$_SERVER['HTTP_X_RHN_PROVISIONING_MAC_4']);
// Make sure the value in $macAddress => 00:02:C9:4F:xx:xx is 00:02:C9:4F:aa:bb or change your array accordingly
$Table = array(
"00:02:C9:10:aa:bb" => "10.0.188.91",
"00:02:C9:4F:aa:bb" => "10.0.188.92",
"00:02:C9:53:aa:bb" => "10.0.188.93",
"00:02:C9:56:aa:bb" => "10.0.188.94",
"00:02:C9:53:aa:bb" => "10.0.188.95",
"00:02:C9:4E:aa:bb" => "10.0.188.96",
"00:02:C9:5A:aa:bb" => "10.0.188.97",
);
$finalAddress = $Table[$macAddress];
printf 'DEVICE=eth4 \nIPADDR=<?php echo $finalAddress ; ?>' > /etc/sysconfig/network-scripts/ifcfg-eth4 '
If you just save the array, it becomes like a useless print out. To make it accessible, use json_encode when you save it:
$fp = fopen('/tmp/request.log', 'w');
fwrite($fp, json_encode($_SERVER));
fclose($fp);
Note how I removed the print_r since it’s unnecessary for a task like this. I also changed fopen to overwrite the file using w instead of a so the saved JSON is valid.
Then when you open the file, just use json_decode like this:
$server_variables_json = file_get_contents('/tmp/request.log');
$server_variables = json_decode($server_variables_json , true);
Then $server_variables is an actual array you can act on like this:
if (array_key_exists('HTTP_X_RHN_PROVISIONING_MAC_4', $server_variables)) {
echo $server_variables['HTTP_X_RHN_PROVISIONING_MAC_4'];
}
The if (array_key_exists(…)) is something I put in place to help me debug this locally on my machine since I don’t have HTTP_X_RHN_PROVISIONING_MAC_4 set in my $_SERVER values.
A simple check I did locally to debug this—since I don’t have HTTP_X_RHN_PROVISIONING_MAC_4 in my setup—was just to get the HTTP_HOST like this:
if (array_key_exists('HTTP_HOST', $server_variables)) {
echo $server_variables['HTTP_HOST'];
}
If you want to put the var $_SERVER["HTTP_X_RHN_PROVISIONING_MAC_4"], don't forgot the quotes.
You need to use quotes to identify a non-numeric index:
echo $_SERVER['HTTP_X_RHN_PROVISIONING_MAC_4'];
You can get more basic information from the docs themselves.
Edit: I am not sure what you mean:
<?php
$array=array(
'HTTP_X_RHN_PROVISIONING_MAC_0' => 'eth0 B4:99:BA:07:xx:xx',
'HTTP_X_RHN_PROVISIONING_MAC_1' => 'eth1 B4:99:BA:07:xx:xx',
'HTTP_X_RHN_PROVISIONING_MAC_2' => 'eth2 B4:99:BA:07:xx:xx',
'HTTP_X_RHN_PROVISIONING_MAC_3' => 'eth3 B4:99:BA:07:xx:xx',
'HTTP_X_RHN_PROVISIONING_MAC_4' => 'eth4 00:02:C9:4F:xx:xx',
'HTTP_X_RHN_PROVISIONING_MAC_5' => 'eth5 00:02:C9:4F:xx:xx'
);
echo "Printing just a single element.\r\n";
echo $array['HTTP_X_RHN_PROVISIONING_MAC_4'];
echo "Printing the whole variable:\r\n";
print_r($array);
?>
Outputs the following:
Printing just a single element.
eth4 00:02:C9:4F:xx:xx
Printing the whole variable:
Array
(
[HTTP_X_RHN_PROVISIONING_MAC_0] => eth0 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_1] => eth1 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_2] => eth2 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_3] => eth3 B4:99:BA:07:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_4] => eth4 00:02:C9:4F:xx:xx
[HTTP_X_RHN_PROVISIONING_MAC_5] => eth5 00:02:C9:4F:xx:xx
)