https://www.icyphoenix.com/viewtopic.php?f=35&t=9188 ----------------------------------- 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] 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 = ''; break; case "Last 48hrs": $day = date("d")-1; $retval = ''; break; case "Last week": $day = date("d")-7; $retval = ''; break; case "last month": $month = date("m")-1; $retval = ''; break; case "last 3 months": $month = date("m")-3; $retval = ''; 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 = ''; // 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 .= "\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 .= "\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, ----------------------------------- mort Wed 22 Jan, 2014 03:08 Re: PHP5.5 And Apache2.4.7 Upgrade Problems ----------------------------------- You are trying to use "echo" in a php file that is NOT a php template. In other words the .php file is running in the background and parsing the information to the .tpl file. You would no doubt have to define what you are trying to echo and add the DEFINED CONSTANT(s) or Defined $variable(s) you use to the .tpl file. This is an example of how "echo" is used when combined in common with the php script when the template is part of the same page. [spoiler] [code linenumbers=false]echo ' '.$lang['post_by'].': '.$author.' '.$title.'
'.$body.' '.$lang['post_on'].': '.$entry_date.' '; echo ' '.SCRSB.' '.IMG_THB.'

'.$lang['pages'].': '; for($i = 1; $i <= $totalpages; $i++){ if($show == $i){$PageAt = 'page-at';}else{$PageAt = 'pagination';} echo ''.$i.''; } echo '

'; };[/code][/spoiler] And [b]PLEASE[/b] use the [b]SPOILER[/b] when you post heaps of code. ----------------------------------- AndyGpy Wed 22 Jan, 2014 08:12 Re: PHP5.5 And Apache2.4.7 Upgrade Problems ----------------------------------- Mort You are missing the point here, the echo command is not the problem, the problem is the variables i have stored in alertsconfig.php are not being included. include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT); The echo command serves its purpose during a fault on the page, the ones that are there after // are only comments and parts of old code that will be removed. if i copy and paste the contents of alertsconfig.php into the code above the full page works. if i dont copy the variable in the page fails with a sql error of SQL ERROR [ mysql4 ] [0] BACKTRACE FILE: includes/db/mysql.php LINE: 111 CALL: sql_db->sql_error() FILE: alertz_VIP.php LINE: 53 CALL: sql_db->sql_db() if i replace the include(IP_ROOT_PATH . '/alerts/alertsconfig.'.PHP_EXT); with $alerts_mysql_username = "username"; // MySQL user name $alerts_mysql_password = "password"; // MySQL password (leave empty $alerts_mysql_db = "scotbirdalerts"; // MySQL database name $alerts_mysql_host = "localhost"; // MySQL server host name then it works. regards ----------------------------------- mort Wed 22 Jan, 2014 12:08 Re: PHP5.5 And Apache2.4.7 Upgrade Problems ----------------------------------- Methinks you have one too many forward slashes here -> include(IP_ROOT_PATH . '[b][color=red][size=20]/[/size][/color][/b]alerts/alertsconfig.'.PHP_EXT); so your path would be translating to www.blah[b]//[/b]alerts/alertsconfig.php? See what I mean - The initial or ROOT Directory paths don't have a forward slash because it's automatically added by IP_ROOT_PATH Constant? [b]include(IP_ROOT_PATH . 'includes/ajax_shoutbox_inc.' . PHP_EXT);[/b] ----------------------------------- AndyGpy Wed 22 Jan, 2014 15:42 Re: PHP5.5 And Apache2.4.7 Upgrade Problems ----------------------------------- Have tried that Mort and it is still the same. :-( Later in Evening -- Hi Mort / MG Figured it out guys, my alertsconfig file contained but i believe PHP 5.5.6 has tighter rules and it must be but all fixed and working. I may have another topic for you shortly , what this space ;-) MORT -- thanks for helping my friend :-) , can you please mark as SOLVED ----------------------------------- mort Wed 22 Jan, 2014 23:52 Re: PHP5.5 And Apache2.4.7 Upgrade Problems ----------------------------------- From memory - php.ini can be configured to cater for short tags