Moron Posted March 2, 2012 Share Posted March 2, 2012 We're moving to a new web server and we recently migrated to a new MS SQL server, as well. All PHP functions on the old web server were switched to point to the new SQL server and all was well. But..... Now I''m trying to move my PHP functions to the new web server and it won't connect to the database. PHP works fine because I can echo "Testing" or whatever. I've downloaded the SQL Server PHP drivers from Microsoft, changed the connection string from MSSQL to SQLSRV, updated the PHP.ini file, and taken several other steps. It still can't see the database. Ideas? Oh, yeah. And both the new web server and MS SQL server are Server 2008 R2. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/ Share on other sites More sharing options...
requinix Posted March 2, 2012 Share Posted March 2, 2012 What do you mean by "can't see"? Can't get to the database machine itself? Can't authenticate? Can't get to the database? Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323125 Share on other sites More sharing options...
Moron Posted March 2, 2012 Author Share Posted March 2, 2012 What do you mean by "can't see"? Can't get to the database machine itself? Can't authenticate? Can't get to the database? It pulls no data. I have a "die" statement and it shows nothing. The exact same file ran from the old web server pulls data galore. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323138 Share on other sites More sharing options...
Adam Posted March 2, 2012 Share Posted March 2, 2012 You'll need to provide the code, Moron. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323144 Share on other sites More sharing options...
requinix Posted March 2, 2012 Share Posted March 2, 2012 Are you sure that it's not showing any data versus PHP crashing and dying? I would bet there's a different problem from the databasework; maybe syntax (are the PHP versions on the old machine and the new machine the same?) maybe settings (how about the php.ini settings?), or maybe something else. As you should to for a development machine, make sure your new web server's php.ini has error_reporting = -1 display_errors = on then restart the web server software (ie, Apache or IIS), run your script(s) again, and look for error messages. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323145 Share on other sites More sharing options...
Moron Posted March 2, 2012 Author Share Posted March 2, 2012 Are you sure that it's not showing any data versus PHP crashing and dying? I would bet there's a different problem from the databasework; maybe syntax (are the PHP versions on the old machine and the new machine the same?) maybe settings (how about the php.ini settings?), or maybe something else. As you should to for a development machine, make sure your new web server's php.ini has error_reporting = -1 display_errors = on then restart the web server software (ie, Apache or IIS), run your script(s) again, and look for error messages. Thanks. I made both changes, saved the file, then stopped and restarted the website in IIS. Same result. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323152 Share on other sites More sharing options...
requinix Posted March 2, 2012 Share Posted March 2, 2012 Do a phpinfo() to make sure the new settings took effect. If View Source doesn't show anything then your code never outputs anything. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323160 Share on other sites More sharing options...
Drummin Posted March 2, 2012 Share Posted March 2, 2012 Are username and password setup on the new server? Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323163 Share on other sites More sharing options...
Moron Posted March 2, 2012 Author Share Posted March 2, 2012 Do a phpinfo() to make sure the new settings took effect. If View Source doesn't show anything then your code never outputs anything. I did, and it made the "-mssql" and "-sqldrv" go away, so I'm thinking that they successfully loaded. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323207 Share on other sites More sharing options...
Moron Posted March 2, 2012 Author Share Posted March 2, 2012 Are username and password setup on the new server? Yes. Authentication is done with SQL Server accounts, and the same account hits this server from the old web sever just fine. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323208 Share on other sites More sharing options...
Moron Posted March 2, 2012 Author Share Posted March 2, 2012 If View Source doesn't show anything then your code never outputs anything. I did this, and WOW. View Source shows me the entire PHP page, including the connection statement with user name and password. So what does this mean? Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323209 Share on other sites More sharing options...
kicken Posted March 2, 2012 Share Posted March 2, 2012 Sounds like your PHP file is not being run. You have not installed/activated PHP correctly. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1323310 Share on other sites More sharing options...
Moron Posted March 5, 2012 Author Share Posted March 5, 2012 Sounds like your PHP file is not being run. You have not installed/activated PHP correctly. But if I go: <? php echo "Testing"; ?> ...it will echo it fine. The browser doesn't display the PHP code; it's only when I View Source. We also have other things running in PHP on this server. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324102 Share on other sites More sharing options...
PFMaBiSmAd Posted March 5, 2012 Share Posted March 5, 2012 You are probably using short open tags <? in some of your files. You should ONLY use full opening <?php tags so that your php code will always be seen as being php code, regardless of which server it is being run on. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324107 Share on other sites More sharing options...
Moron Posted March 5, 2012 Author Share Posted March 5, 2012 You are probably using short open tags <? in some of your files. You should ONLY use full opening <?php tags so that your php code will always be seen as being php code, regardless of which server it is being run on. Nope. It's all long tags. Here's the code: <?php $msconnect=sqlsrv_connect('SERVERNAME','username','password') or die ("Could not connect to database: ".sqlsrv_get_last_message());; $msdb=sqlsrv_select_db("TableName",$msconnect) or die ("Could not connect to table: ".sqlsrv_get_last_message());; ?> <?php if($_POST['THOUSE'] || $_POST['TNSEW'] || $_POST['TSTNAM']) { $where = " WHERE (THOUSE LIKE '%{$_POST['THOUSE']}%' AND TNSEW LIKE '%{$_POST['TNSEW']}%' AND TSTNAM LIKE '%{$_POST['TSTNAM']}%')"; $order = " ORDER BY THOUSE, TNSEW, TSTNAM"; } elseif ($_POST['TRECTN']) { if (!$_POST['TTAXYRa']) { $_POST['TTAXYRa'] = date("Y"); } $where = " WHERE (TRECTN = '{$_POST['TRECTN']}' AND TTAXYR = '{$_POST['TTAXYRa']}')"; $order = " ORDER BY TRECTN"; } elseif($_POST['TNAME1']) { $where = " WHERE (TNAME1 LIKE '%{$_POST['TNAME1']}%')"; $order = " ORDER BY TNAME1, TNAME2"; } elseif($_POST['TMAPN'] || $_POST['TMAPA'] || $_POST['TPARCL'] || $_POST['TGROUP'] || $_POST['TPICOD'] || $_POST['TSPCIN']) { $where = " WHERE (TMAPN LIKE '%{$_POST['TMAPN']}%' AND TMAPA LIKE '%{$_POST['TMAPA']}%' AND TPARCL LIKE '%{$_POST['TPARCL']}%' AND TGROUP LIKE '%{$_POST['TGROUP']}%' AND TPICOD LIKE '%{$_POST['TPICOD']}%' AND TSPCIN LIKE '%{$_POST['TSPCIN']}%')"; $order = " ORDER BY TMAPN,TMAPA,TPARCL"; } else { header("location: TestSearch.php"); } if ($_POST['TTAXYR'] && !$_POST['TTAXYRa']) { $where .= " AND (TTAXYR = ".date("Y").")"; } $order .= ", TTAXYR DESC"; $query = "SELECT TRECTN,TTAXYR, TNAME1, TSTADR, TTXAMT, TTXBAL, THOUSE, TNSEW, TSTNAM FROM viewTAXINFO_FULL $where $order"; $result = @sqlsrv_query($query); if (@sqlsrv_num_rows($result) == 1) { $row = @sqlsrv_fetch_assoc($result); header("location: TestView.php?TRECTN={$row['TRECTN']}&TTAXYR={$row['TTAXYR']}"); exit; } ?> <html> <head> <title>CITY OF OAK RIDGE PROPERTY TAX SEARCH RESULTS</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} h1 {margin:0in; margin-bottom:.0001pt; page-break-after:avoid; font-size:12.0pt; font-family:"Times New Roman";} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText {margin:0in; margin-bottom:.0001pt; font-size:10.0pt; font-family:Verdana; color:black;} p.bodytext, li.bodytext, div.bodytext {margin-right:0in; margin-left:0in; font-size:10.0pt; font-family:Verdana; color:black;} @page Section1 {size:8.5in 11.0in; margin:.2in .2in .2in .2in;} div.Section1 {page:Section1;} table { font-family: Arial, Helvetica, sans-serif; font-size: 11px; } --> </style> <link rel=Original-File href=TestSearch.php> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <center> <body lang=EN-US topmargin="5" leftmargin="3"> <div class=Section1> <table width="480" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="230" bgcolor="#006633"><span class="style1"><center>Owner</center></span></td> <td width="190" bgcolor="#006633"><span class="style1"><center>Address</center></span></td> <td width="10" bgcolor="#006633"><span class="style1"><center>Tax Year </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Tax Amount</center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Balance </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Receipt </center></span></td> </tr> <?php if (@sqlsrv_num_rows($result) > 0) { ?> <?php while($row = @sqlsrv_fetch_assoc($result)) { ?> <tr> <td bgcolor="#E2E2E2"><a href="TestView.php?TRECTN=<?php= $row['TRECTN']; ?>&TTAXYR=<?php= $row['TTAXYR']; ?>"> <?php= $row['TNAME1']; ?> </a> </td> <td bgcolor="#E2E2E2"> <?php= $row['THOUSE']; ?> <?php= $row['TNSEW']; ?> <?php= $row['TSTNAM']; ?></td> <td bgcolor="#E2E2E2"> <div align="center"> <?php= $row['TTAXYR']; ?></div></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXAMT'],2); ?></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXBAL'],2); ?></td> <td align="right" bgcolor="#E2E2E2"><?php= ($row['TRECTN']); ?></td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="5">Search yielded no results.</td></tr> <?php } ?> </table> </center> </body> </html> And again, this same code (modified here to remove private info) runs against the same SQL server just fine from another web server. I'm stumped. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324113 Share on other sites More sharing options...
PFMaBiSmAd Posted March 5, 2012 Share Posted March 5, 2012 Is this code (that you see the raw php code in the 'view source' in your browser) in the same folder where you have tried php code that does work? Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324117 Share on other sites More sharing options...
Moron Posted March 5, 2012 Author Share Posted March 5, 2012 Is this code (that you see the raw php code in the 'view source' in your browser) in the same folder where you have tried php code that does work? EDIT: I think I misunderstood you. Sorry about that. On the same file that shows me nothing, I can echo things and they display properly. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324119 Share on other sites More sharing options...
jason310771 Posted March 5, 2012 Share Posted March 5, 2012 Ok I have checked your code and would like you to use the following amended code. I have removed the @ suppressors. This will show any errors that may have been suppressed. If you get any errors post them back here. <?php $msconnect=sqlsrv_connect('SERVERNAME','username','password') or die ("Could not connect to database: ".sqlsrv_get_last_message());; $msdb=sqlsrv_select_db("TableName",$msconnect) or die ("Could not connect to table: ".sqlsrv_get_last_message());; ?> <?php if($_POST['THOUSE'] || $_POST['TNSEW'] || $_POST['TSTNAM']) { $where = " WHERE (THOUSE LIKE '%{$_POST['THOUSE']}%' AND TNSEW LIKE '%{$_POST['TNSEW']}%' AND TSTNAM LIKE '%{$_POST['TSTNAM']}%')"; $order = " ORDER BY THOUSE, TNSEW, TSTNAM"; } elseif ($_POST['TRECTN']) { if (!$_POST['TTAXYRa']) { $_POST['TTAXYRa'] = date("Y"); } $where = " WHERE (TRECTN = '{$_POST['TRECTN']}' AND TTAXYR = '{$_POST['TTAXYRa']}')"; $order = " ORDER BY TRECTN"; } elseif($_POST['TNAME1']) { $where = " WHERE (TNAME1 LIKE '%{$_POST['TNAME1']}%')"; $order = " ORDER BY TNAME1, TNAME2"; } elseif($_POST['TMAPN'] || $_POST['TMAPA'] || $_POST['TPARCL'] || $_POST['TGROUP'] || $_POST['TPICOD'] || $_POST['TSPCIN']) { $where = " WHERE (TMAPN LIKE '%{$_POST['TMAPN']}%' AND TMAPA LIKE '%{$_POST['TMAPA']}%' AND TPARCL LIKE '%{$_POST['TPARCL']}%' AND TGROUP LIKE '%{$_POST['TGROUP']}%' AND TPICOD LIKE '%{$_POST['TPICOD']}%' AND TSPCIN LIKE '%{$_POST['TSPCIN']}%')"; $order = " ORDER BY TMAPN,TMAPA,TPARCL"; } else { header("location: TestSearch.php"); } if ($_POST['TTAXYR'] && !$_POST['TTAXYRa']) { $where .= " AND (TTAXYR = ".date("Y").")"; } $order .= ", TTAXYR DESC"; $query = "SELECT TRECTN,TTAXYR, TNAME1, TSTADR, TTXAMT, TTXBAL, THOUSE, TNSEW, TSTNAM FROM viewTAXINFO_FULL $where $order"; $result = @sqlsrv_query($query); if (@sqlsrv_num_rows($result) == 1) { $row = sqlsrv_fetch_assoc($result); header("location: TestView.php?TRECTN={$row['TRECTN']}&TTAXYR={$row['TTAXYR']}"); exit; } ?> <html> <head> <title>CITY OF OAK RIDGE PROPERTY TAX SEARCH RESULTS</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} h1 {margin:0in; margin-bottom:.0001pt; page-break-after:avoid; font-size:12.0pt; font-family:"Times New Roman";} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText {margin:0in; margin-bottom:.0001pt; font-size:10.0pt; font-family:Verdana; color:black;} p.bodytext, li.bodytext, div.bodytext {margin-right:0in; margin-left:0in; font-size:10.0pt; font-family:Verdana; color:black;} @page Section1 {size:8.5in 11.0in; margin:.2in .2in .2in .2in;} div.Section1 {page:Section1;} table { font-family: Arial, Helvetica, sans-serif; font-size: 11px; } --> </style> <link rel=Original-File href=TestSearch.php> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <center> <body lang=EN-US topmargin="5" leftmargin="3"> <div class=Section1> <table width="480" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="230" bgcolor="#006633"><span class="style1"><center>Owner</center></span></td> <td width="190" bgcolor="#006633"><span class="style1"><center>Address</center></span></td> <td width="10" bgcolor="#006633"><span class="style1"><center>Tax Year </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Tax Amount</center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Balance </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Receipt </center></span></td> </tr> <?php if (sqlsrv_num_rows($result) > 0) { ?> <?php while($row = sqlsrv_fetch_assoc($result)) { ?> <tr> <td bgcolor="#E2E2E2"><a href="TestView.php?TRECTN=<?php= $row['TRECTN']; ?>&TTAXYR=<?php= $row['TTAXYR']; ?>"> <?php= $row['TNAME1']; ?> </a> </td> <td bgcolor="#E2E2E2"> <?php= $row['THOUSE']; ?> <?php= $row['TNSEW']; ?> <?php= $row['TSTNAM']; ?></td> <td bgcolor="#E2E2E2"> <div align="center"> <?php= $row['TTAXYR']; ?></div></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXAMT'],2); ?></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXBAL'],2); ?></td> <td align="right" bgcolor="#E2E2E2"><?php= ($row['TRECTN']); ?></td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="5">Search yielded no results.</td></tr> <?php } ?> </table> </center> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324124 Share on other sites More sharing options...
Moron Posted March 5, 2012 Author Share Posted March 5, 2012 Ok I have checked your code and would like you to use the following amended code. I have removed the @ suppressors. This will show any errors that may have been suppressed. If you get any errors post them back here. <?php $msconnect=sqlsrv_connect('SERVERNAME','username','password') or die ("Could not connect to database: ".sqlsrv_get_last_message());; $msdb=sqlsrv_select_db("TableName",$msconnect) or die ("Could not connect to table: ".sqlsrv_get_last_message());; ?> <?php if($_POST['THOUSE'] || $_POST['TNSEW'] || $_POST['TSTNAM']) { $where = " WHERE (THOUSE LIKE '%{$_POST['THOUSE']}%' AND TNSEW LIKE '%{$_POST['TNSEW']}%' AND TSTNAM LIKE '%{$_POST['TSTNAM']}%')"; $order = " ORDER BY THOUSE, TNSEW, TSTNAM"; } elseif ($_POST['TRECTN']) { if (!$_POST['TTAXYRa']) { $_POST['TTAXYRa'] = date("Y"); } $where = " WHERE (TRECTN = '{$_POST['TRECTN']}' AND TTAXYR = '{$_POST['TTAXYRa']}')"; $order = " ORDER BY TRECTN"; } elseif($_POST['TNAME1']) { $where = " WHERE (TNAME1 LIKE '%{$_POST['TNAME1']}%')"; $order = " ORDER BY TNAME1, TNAME2"; } elseif($_POST['TMAPN'] || $_POST['TMAPA'] || $_POST['TPARCL'] || $_POST['TGROUP'] || $_POST['TPICOD'] || $_POST['TSPCIN']) { $where = " WHERE (TMAPN LIKE '%{$_POST['TMAPN']}%' AND TMAPA LIKE '%{$_POST['TMAPA']}%' AND TPARCL LIKE '%{$_POST['TPARCL']}%' AND TGROUP LIKE '%{$_POST['TGROUP']}%' AND TPICOD LIKE '%{$_POST['TPICOD']}%' AND TSPCIN LIKE '%{$_POST['TSPCIN']}%')"; $order = " ORDER BY TMAPN,TMAPA,TPARCL"; } else { header("location: TestSearch.php"); } if ($_POST['TTAXYR'] && !$_POST['TTAXYRa']) { $where .= " AND (TTAXYR = ".date("Y").")"; } $order .= ", TTAXYR DESC"; $query = "SELECT TRECTN,TTAXYR, TNAME1, TSTADR, TTXAMT, TTXBAL, THOUSE, TNSEW, TSTNAM FROM viewTAXINFO_FULL $where $order"; $result = @sqlsrv_query($query); if (@sqlsrv_num_rows($result) == 1) { $row = sqlsrv_fetch_assoc($result); header("location: TestView.php?TRECTN={$row['TRECTN']}&TTAXYR={$row['TTAXYR']}"); exit; } ?> <html> <head> <title>CITY OF OAK RIDGE PROPERTY TAX SEARCH RESULTS</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} h1 {margin:0in; margin-bottom:.0001pt; page-break-after:avoid; font-size:12.0pt; font-family:"Times New Roman";} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText {margin:0in; margin-bottom:.0001pt; font-size:10.0pt; font-family:Verdana; color:black;} p.bodytext, li.bodytext, div.bodytext {margin-right:0in; margin-left:0in; font-size:10.0pt; font-family:Verdana; color:black;} @page Section1 {size:8.5in 11.0in; margin:.2in .2in .2in .2in;} div.Section1 {page:Section1;} table { font-family: Arial, Helvetica, sans-serif; font-size: 11px; } --> </style> <link rel=Original-File href=TestSearch.php> <style type="text/css"> <!-- .style1 { color: #FFFFFF; font-weight: bold; } --> </style> </head> <center> <body lang=EN-US topmargin="5" leftmargin="3"> <div class=Section1> <table width="480" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="230" bgcolor="#006633"><span class="style1"><center>Owner</center></span></td> <td width="190" bgcolor="#006633"><span class="style1"><center>Address</center></span></td> <td width="10" bgcolor="#006633"><span class="style1"><center>Tax Year </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Tax Amount</center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Balance </center></span></td> <td width="25" bgcolor="#006633"><span class="style1"><center>Receipt </center></span></td> </tr> <?php if (sqlsrv_num_rows($result) > 0) { ?> <?php while($row = sqlsrv_fetch_assoc($result)) { ?> <tr> <td bgcolor="#E2E2E2"><a href="TestView.php?TRECTN=<?php= $row['TRECTN']; ?>&TTAXYR=<?php= $row['TTAXYR']; ?>"> <?php= $row['TNAME1']; ?> </a> </td> <td bgcolor="#E2E2E2"> <?php= $row['THOUSE']; ?> <?php= $row['TNSEW']; ?> <?php= $row['TSTNAM']; ?></td> <td bgcolor="#E2E2E2"> <div align="center"> <?php= $row['TTAXYR']; ?></div></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXAMT'],2); ?></td> <td align="right" bgcolor="#E2E2E2">$<?php= number_format($row['TTXBAL'],2); ?></td> <td align="right" bgcolor="#E2E2E2"><?php= ($row['TRECTN']); ?></td> </tr> <?php } ?> <?php } else { ?> <tr><td colspan="5">Search yielded no results.</td></tr> <?php } ?> </table> </center> </body> </html> Thanks, but.......it still comes up totally blank. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324144 Share on other sites More sharing options...
PFMaBiSmAd Posted March 6, 2012 Share Posted March 6, 2012 Ummm. That code still has several @ error suppressors in front of php statements. Until you remove all of the @'s in the php code, you won't get accurate reporting of errors that would help you determine what is happening. In the phpinfo() output, what values are shown for the error_reporting and display_errors settings? Don't ever use @'s in your php code to suppress errors, they are not need. On a development system (or when debugging your code), you would have php's display_errors set to ON. On a live site, you would have php's display_errors set to OFF and log_errors set to ON. Going back to some previous information in this thread. Did you or did you not do a 'view source' of a blank page in your browser and see the raw php code? Also, a question I asked that wasn't really answered - are all these php files (the one with posted code, the ones that work, the one with the phpinfo() statement in it) in the same folder or are they in different paths/folders (i.e. do php files at one path, say the document root, work and php files in a folder don't work and show the raw php code in the 'view source' of the page in your browser)? Are you accessing this 'new' web server locally (i.e. where is it located vs where your client computer is located)? Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324438 Share on other sites More sharing options...
PFMaBiSmAd Posted March 6, 2012 Share Posted March 6, 2012 I just looked at the code on your page closer and you have a number of statements like this <?php= You did have some <?= short tags/print statements in your (working) code and you blindly did a search and replace to change <? into <?php didn't you? Now you either need to go back to your working original source code or you need to go though all your current code and change the <?php= to <?php echo Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324447 Share on other sites More sharing options...
Muddy_Funster Posted March 6, 2012 Share Posted March 6, 2012 once youve fixed the issue PFM has pointed out could you also give us a better idea of the servers (old and new) that you are using, namely IIS/Apache version, PHP version, PHP runtime environment. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324449 Share on other sites More sharing options...
Moron Posted March 6, 2012 Author Share Posted March 6, 2012 Thanks, everyone, and sorry about my delayed response. What a day. Okay, from the top..... I went back and removed all of the suppressors (@) from the code. PFM, you are correct. I did exactly that, searched and replaced "<?" with "<?php." I'll go back in and fix that. For some reason, it no longer displays the php code when I right-click and View Source. I don;t know what "fixed" that. And again, I appreciate everyone's suggestions. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324595 Share on other sites More sharing options...
Moron Posted March 6, 2012 Author Share Posted March 6, 2012 Okay, I have an update and it gets weirder by the minute. I replaced the "<?" tags with "<?php." All fine and good. Except......I can't do this on the very first tag. If I use the short tag, I get this: I know the data is there (and plenty of it), yet it shows me nothing. If I use the long tag, only on this first tag at the top, I get a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324602 Share on other sites More sharing options...
Moron Posted March 6, 2012 Author Share Posted March 6, 2012 Also, the Results page is back to showing me the full page code if I View Source. Help..... Quote Link to comment https://forums.phpfreaks.com/topic/258111-php-on-new-server-no-longer-connects-mssql/#findComment-1324608 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.