https://www.icyphoenix.com/viewtopic.php?f=35&t=9188&p=59456#p59456
-----------------------------------
AndyGpy
Wed 22 Jan, 2014 00:24

PHP5.5 And Apache2.4.7 Upgrade Problems
-----------------------------------
Right Guys i have created a standard page

[code linenumbers=false]
<?php
/***************************************************************************
 *                                Alertz.php
 *                            -------------------
 *   begin                : 30/10/04/10
 *   copyright         : (C) 2010 Andy Guppy
 *   email                : webmaster@scotbird.co.uk
 *
 *
 ***************************************************************************/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));

// Include files 
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management


$meta_content['page_title'] = 'Scotbird Alertz System';
$meta_content['description'] = 'Rare and Unusual sightings throughout Scotland';
$meta_content['keywords'] = '';

if (!$user->data['session_logged_in'])

{

    redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=alertz_VIP.' . PHP_EXT, true));
    exit;
}

else
	// Yes they are
   {
   
        // Obtain Select Criteria
		$temp_region_filter = $_GET["REGION_FILTER"];
		$temp_species_filter = $_GET["SPECIES_FILTER"];
		$temp_date_filter = $_GET["DATE_FILTER"];

		// Filter characters if required
		$region_filter =str_replace(" & ", "&", $temp_region_filter);
		$species_filter = $temp_species_filter;
		$date_filter = $temp_date_filter;
		
		// Connect to the database 
		$db = new sql_db($alerts_mysql_host,$alerts_mysql_username,$alerts_mysql_password,$alerts_mysql_db,false);
     	if(!$db) 
		{
        	die("Database Connection Failed:- Please Contact Site Admin" . mysql_error());
    	}
		//$template->set_filenames(array('body' => 'alertz_VIP.tpl'));
		//$template->_tpldata['alertz_VIP.'] = array();
 // Some consistant Variables
		$year =date("Y");
		$month = date("m");
		$day = date("d");
       
        function datedropdown_funct($switchstring)
        {
            $year =date("Y");
            $month = date("m");
            $day = date("d");
                    switch ($switchstring) 
	               {
                    
				    case "Today":
                        $day = date("d");
					    $retval = '<option value="">Select</option><option value="Today" SELECTED>Today</option><option value="Last 48hrs">Last 48hrs</option><option value="Last week">Last Week</option><option value="last month">Last Month</option>';
                    break;
				    case "Last 48hrs":
					   $day = date("d")-1;
					   $retval = '<option value="">Select</option><option value="Today">Today</option><option value="Last 48hrs" SELECTED>Last 48hrs</option><option value="Last week">Last Week</option><option value="last month">Last Month</option>';
                    break;	
				    case "Last week":
    					$day = date("d")-7;
    					$retval =  '<option value="">Select</option><option value="Today">Today</option><option value="Last 48hrs">Last 48hrs</option><option value="Last week" SELECTED>Last Week</option><option value="last month">Last Month</option>';
                	break;
    				case "last month":
    					$month = date("m")-1;
    					$retval =  '<option value="">Select</option><option value="Today">Today</option><option value="Last 48hrs">Last 48hrs</option><option value="Last week">Last Week</option><option value="last month" SELECTED>Last Month</option>';
                    break;
    				case "last 3 months":
    					$month = date("m")-3;
    					$retval = '<option value="">Select</option><option value="Today">Today</option><option value="Last 48hrs">Last 48hrs</option><option value="Last week">Last Week</option><option value="last month">Last Month</option><option value="last 3 months" SELECTED>Last 3 Month</option>';
                    break;
    				default:
    					// Default is the last 48hrs
    					$day = date("d")-3;
                        
			        }  
                    $thestartdatecalc  = $year . '-' .$month . '-' . $day ;
                    // echo $thestartdate;
                    return array($retval, $thestartdatecalc);
            }        


$theenddate  = $year . '-' .$month . '-' . $day ;

        // Check if the Date is Set
        if(isset($date_filter) and strlen($date_filter) > 0)
		{
			// The date is Set
			// echo "Date is Set :- " . $date_filter .  " - ";
			// Check to see if Region is set
			if(isset($region_filter) and strlen($region_filter) > 0)
			{
            // The region is set
				// echo "Region is Set :- " . $region_filter .  " - ";
				// Check to see if species is set
                if(isset($species_filter) and strlen($species_filter) > 0)
                {
					// The species is set
					// echo "Species is Set :- " . $species_filter .  " - ";
                    list($arr1, $arr2) = datedropdown_funct($date_filter);
                    $date_filter_options= $arr1;
                    $thestartdate.= $arr2;  
               		$sql2 = "SELECT * FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND region = '".$region_filter ."' AND species = '".$species_filter ."' ORDER BY Date DESC, time DESC  ";
	                $sql3 = "SELECT DISTINCT species FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND region = '". $region_filter . "' GROUP BY species";
                    $sql = "SELECT DISTINCT region FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND species = '".$species_filter ."'  GROUP BY region";   
                
                }
                else
                {
					// The species is Not Set
					// echo "Species is NOT set - ";
                    list($arr1, $arr2) = datedropdown_funct($date_filter);
                    $date_filter_options= $arr1;
                    $thestartdate.= $arr2; 
    				$sql2 = "SELECT * FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND region = '".$region_filter ."'  ORDER BY Date DESC, time DESC  ";
	                $sql3 = "SELECT DISTINCT species FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND region = '". $region_filter . "' GROUP BY species";
                    $sql = "SELECT DISTINCT region FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' GROUP BY region";   
 
                
               }
            }
          else
          {
				// The region is not set
				// echo "Region is NOT set - ";         
				// Check to see if species is set
				if(isset($species_filter) and strlen($species_filter) > 0)
				{
					// The species is set
					// echo "Species is Set :- " . $species_filter .  " - ";
					list($arr1, $arr2) = datedropdown_funct($date_filter);
					$date_filter_options= $arr1;
					$thestartdate.= $arr2;     
					$sql2 = "SELECT * FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND species = '".$species_filter  ."' ORDER BY Date DESC, time DESC  ";
					$sql3 = "SELECT DISTINCT species FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."'  GROUP BY species";
					$sql = "SELECT DISTINCT region FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."' AND species = '".$species_filter  ."'  GROUP BY region";   
				}
				else
				{
					// The species is NOT Set
					// echo "Species is NOT set - ";
					list($arr1, $arr2) = datedropdown_funct($date_filter);
					$date_filter_options= $arr1;
					$thestartdate.= $arr2; 
					$sql2 = "SELECT * FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."'  ORDER BY Date DESC, time DESC  ";
					$sql3 = "SELECT DISTINCT species FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."'  GROUP BY species";
					$sql = "SELECT DISTINCT region FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."'  GROUP BY region";   
				}
  		   }
        }
		else
		{
		 // The date is not set
		 $date_filter_options = '<option value="">Select</option><option value="Today">Today</option><option value="Last 48hrs">Last 48hrs</option><option value="Last week">Last Week</option><option value="last month">Last Month</option>';
		 // echo "Date is NOT set - ";
          // Check to see if Region is set
          if(isset($region_filter) and strlen($region_filter) > 0)
          {         
            // The region is set
            // echo "Region is Set :- " . $region_filter .  " - ";
            // Check to see if species is set
                if(isset($species_filter) and strlen($species_filter) > 0)
                {
                // The species is Set
                // echo "Species is Set :- " . $species_filter .  " - ";
                                // Build the SQL strings
				$sql2 = "SELECT * FROM alerts WHERE species ='".$species_filter ."' AND region = '".$region_filter  ."' ORDER BY Date DESC, time DESC  ";
				$sql = "SELECT DISTINCT region FROM alerts WHERE species ='".$species_filter ."' GROUP BY region";
                $sql3 = "SELECT DISTINCT species FROM alerts WHERE region ='".$region_filter ."' GROUP BY species";
                 // 
            
                }
                else
                {
                 // The species is not set
                // echo "Species is NOT set - ";
                $sql2 = "SELECT * FROM alerts WHERE region = '".$region_filter  ."' ORDER BY Date DESC, time DESC  ";
				$sql = "SELECT DISTINCT region FROM alerts WHERE species ='".$species_filter ."' GROUP BY region";
                $sql3 = "SELECT DISTINCT species FROM alerts WHERE region ='".$region_filter ."' GROUP BY species";
                }              
                
          }
          else
          {
            // The region is Set
            // echo "Region is NOT set - ";
            // Check to see if species is set
                if(isset($species_filter) and strlen($species_filter) > 0)
                {
                // The species is Set
                // echo "Species is Set :- " . $species_filter .  " - " ;

                // Build the SQL strings
				$sql2 = "SELECT * FROM alerts WHERE species ='".$species_filter ."'  ORDER BY Date DESC, time DESC  ";
				$sql = "SELECT DISTINCT region FROM alerts GROUP BY region";
                $sql3 = "SELECT DISTINCT species FROM alerts WHERE species ='".$species_filter ."' GROUP BY species";
                 // 
  
                
            
                }
                else
                {
                 // The species is not set
                 // echo "Species is NOT set - ";
                 
                // We will only display 5 days worth of Data
				$year =date("Y");
				$month = date("m");
				$day = date("d")-3;
				$thestartdate  = $year . '-' .$month . '-' . $day ;
                // Build the SQL strings
				$sql2 = "SELECT * FROM alerts WHERE Date BETWEEN '".$thestartdate ."' AND '".$theenddate ."'  ORDER BY Date DESC, time DESC  ";
				$sql3 = "SELECT DISTINCT species FROM alerts GROUP BY species";
				$sql = "SELECT DISTINCT region FROM alerts GROUP BY region";
                }
          }
		}


		$result2 = $db->sql_query($sql2);
		if (!($result2 = $db->sql_query($sql2)))
		{
			die("Database Query Failed" . mysql_error());
		} 
		$i  = 1;

		while ( $row2 = $db->sql_fetchrow($result2) )
			{
				//if (($userdata['user_rank2'] == 5))
				//{
				$template->assign_block_vars('alerts', array( 'POS' => $i ,
						'REGION' => str_replace("&", " & ", $row2['region']),
						'SPECIES' => str_replace("%", "'",$row2['species']),
						'DATE' => $row2['Date'],
						'TIME' =>  $row2['time'],
						'COMMENTS' => str_replace("'", "%",$row2['comments']),
						)
					);
				$i++;
				//}
				//else
				//{
				//		$template->assign_block_vars('alerts', array( 'POS' => $i ,
				//		'REGION' => "VIP MEMBERS ONLY",
				//		'SPECIES' => str_replace("%", "'",$row2['species']),
				//		'DATE' => $row2['Date'],
				//		'TIME' =>  $row2['time'],
				//		'COMMENTS' => "Become a VIP and get full access",
				//		)
				//	);
				//$i++;
				//}
			}

		$template->assign_vars(array(
				'USERNAME' => htmlspecialchars($user->data[username]),
				'REGION_FILTER' => str_replace("&", " & ", $region_filter_options),
				'SPECIES_FILTER' => $species_filter_options,
				)
			);
	
		$result = $db->sql_query($sql2);
	  
		if (!($result = $db->sql_query($sql2)))
			{
  			 	die("Database Query Failed" . mysql_error());
			} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.


        while ($row = $db->sql_fetchrow($result))
                {
                    $selected = (isset($_GET['REGION_FILTER']) AND $_GET['REGION_FILTER']==$row['region']) ? ' selected="selected"' : '' ;
                    $region_filter_options .= "<option value=\"{$row['region']}\"{$selected}>{$row['region']}</option>\n";
                }
				
		
	
		$result = $db->sql_query($sql3);
	  
		if (!($result = $db->sql_query($sql3)))
			{
  			 	die("Database Query Failed" . mysql_error());
			} 

		// This is where you would add a new VARS Array if you intend to use your own custom VARS.
		while ($row = $db->sql_fetchrow($result))
                {
                    $selected = (isset($_GET['SPECIES_FILTER']) AND $_GET['SPECIES_FILTER']==$row['species']) ? ' selected="selected"' : '' ;
                    $species_filter_options .= "<option value=\"{$row['species']}\"{$selected}>{$row['species']}</option>\n";
                }
                
	
			
		$template->assign_vars(array(
				'USERNAME' => htmlspecialchars($user->data[username]),
				'REGION_FILTER' => str_replace("&", " & ", $region_filter_options),
				'SPECIES_FILTER' => $species_filter_options,
				
			)
		);	
		

		$template->assign_vars(array(
				'USERNAME' => htmlspecialchars($user->data[username]),
				'DATE_FILTER' => $date_filter_options,	
			)
		);	
			
		// Build the page
		//$template->pparse('body');


				
   }
   		//full_page_generation();
				full_page_generation('alertz_VIP.tpl', '', '', '');
?>
[/code]

Before upgrading from Apache 2.2 to 2.2.4.7 and PHP 5.3 to 5.5, this page worked a treat. Now i get nothing from the databases, after puting in a small echo to display the out the username of the database 

echo "DB Username is :- " . $alerts_mysql_username

which is passed in the 

include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT);

as a variable called 

$alerts_mysql_username

the name is not displayed, if i set the variables in the above code for the database configuration the program will work, but i would like to remain as original code was ie call a database config file "alertsconfig.php".

Any suggestions as to why this will no longer work, i have tried it in IP 2.0 and also the same statement in IP1.53, i know no support is given for IP1.53, but my reference to it is so that you guys know that it does not just affect IP2.0 specifically.

I am a newbie when it comes to PHP settings and feel there must ne something fundamental i am missing.


when run nothing is displayed by the echo command,


