nlandgraf Posted August 6, 2009 Share Posted August 6, 2009 I downloaded my website files to my computer at home so I can update them when I have time. I am running an apache server at home and my web host provider is using iis. When I view one of my webpages it returns script from the webpage, because it is trying to connect to the database. What can I do to view the page without running into this problem? Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/ Share on other sites More sharing options...
wildteen88 Posted August 6, 2009 Share Posted August 6, 2009 Can explain your problem more clearly. Also I am assuming you have setup Apache with PHP? Apache on its own wont be enough to run your scripts. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891806 Share on other sites More sharing options...
onthespot Posted August 6, 2009 Share Posted August 6, 2009 Not sure if what i'm about to say is correct, but can't you change your database settings? "localhost" "root" "" "db name" Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891808 Share on other sites More sharing options...
nlandgraf Posted August 6, 2009 Author Share Posted August 6, 2009 Yes, I have installed PHP with Apache. When I preview the page the following script is returned: SetSettings(); error_reporting (E_ERROR | E_WARNING | E_PARSE); if (isset ($HTTP_SERVER_VARS)) { $_SERVER = $HTTP_SERVER_VARS; } ?> GetDefault(); include("language/".$LangObj->GetLanguagefile()); $langvar = $msg; } else { } $Pageobj = $SiteObj->GetPageObject($xview,$DB); if($Pageobj) { // Common metadata $page_title = $Pageobj->GetPagetitle(); $meta_keywords = $Pageobj->GetMetakeywords(); $meta_description = $Pageobj->GetMetadesc(); } else { // Common metadata $page_title = "Game Rental"; $meta_keywords = "Sport,Bets,Odds,Bookmakers,Lotto,Sportsbook,Bettings,Games,Fixture,sportsbook, online Lotto, sports betting, horse racing,football , online betting, online sportsbook, betting odds"; $meta_description = "$site_name is a Online Sports Betting Site.Users can Make bets on all gam,es available and can win money.He can also play Lotto games."; } //platformlinks $PlatFormObj1 = new Platform('', $DB); $PlatFormObj = $PlatFormObj1->GetAll(); $platformlinks = ""; foreach($PlatFormObj as $ObjPlatform) { if($settings['Safe_Urls']) { $platformlink = "Platform/GameCatelog/".$ObjPlatform->GetPlatformid()."_".$ObjPlatform->GetTitle().".html"; } else { $platformlink = "index.php?view=catalog&pfid=".$ObjPlatform->GetPlatformid(); } $platformlinks .= "".$ObjPlatform->GetTitle()." | "; } //site box $Boxes1 = new DesignBox('', $DB); $leftBoxes = $Boxes1->GetAllLeftBox($Pageobj->GetPageid()); $RightBoxes = $Boxes1->GetAllRightBox($Pageobj->GetPageid()); //sitelayout switch($settings["LayoutSiteWidth"]){ case "100" : $site_width = "100%"; $site_align = "center"; $stylesite = "margin-left:0px;margin-right:0px;"; break; case "1024c" : $site_width = "960px"; $site_align = "center"; $stylesite = "margin-left:auto;margin-right:auto;"; break; case "1024l" : $site_width = "960px"; $site_align = "left"; $stylesite = "margin-left:0px;margin-right:0px;"; break; case "800c" : $site_width = "777px"; $site_align = "center"; $stylesite = "margin-left:auto;margin-right:auto;"; break; case "800l" : $site_width = "777px"; $site_align = "left"; $stylesite = "margin-left:0px;margin-right:0px;"; break; } //skin include("skins/".$settings['CurrentSkin']."/index.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891818 Share on other sites More sharing options...
wildteen88 Posted August 6, 2009 Share Posted August 6, 2009 Are you using short tags in your code (<? ?> or <?= ?>) By default short tags are not enabled. You need to enable short tags for your code to work properly. Also you need to be saving all your sites files in Apaches htdocs folder (C/path/to/apache/htdocs). You must also be going to http://localhost to run your php scripts. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891822 Share on other sites More sharing options...
nlandgraf Posted August 6, 2009 Author Share Posted August 6, 2009 It's been 4-5 years since I have done any programming with php and I'm struggling a bit to remember and don't know what exactly you mean by using the ?. How do I enable short tags? All of my files are saved to the htdocs folder. I am also going to http://localhost to view the files; all directories are showing. Below is the script for the index page so that you can see exactly what may be the problem. <? include_once("config.inc.php"); include_once("adodb/adodb.inc.php"); include_once("classes/class_site.php"); include_once("model/class_pages.php"); include_once("model/class_design_boxes.php"); include_once("model/class_platform.php"); include_once("model/class_category.php"); include_once("model/class_language.php"); $SiteObj = new Site(); $settings = $SiteObj->SetSettings(); error_reporting (E_ERROR | E_WARNING | E_PARSE); if (isset ($HTTP_SERVER_VARS)) { $_SERVER = $HTTP_SERVER_VARS; } ?> <? if($_REQUEST['item_type'] == 'G') $Itemtype = 'G'; else $Itemtype = 'M'; //HomeLink if($settings['Safe_Urls']) $homelink = "Home.html"; else $homelink = "index.php?view=main"; //Registration Link if($settings['Safe_Urls']) $reglink = "SignUp.html"; else $reglink = "index.php?view=signup"; //login if($settings['Safe_Urls']) $loginlink = "Login.html"; else $loginlink = "index.php?view=login"; //forgot password if($settings['Safe_Urls']) $forgotpasswordlink = "ForgotPassword.html"; else $forgotpasswordlink = "index.php?view=forgotpassword"; if($settings['Safe_Urls']) $rentqueuelink = "RentQueue.html"; else $rentqueuelink = "index.php?view=rentqueue"; if($settings['Safe_Urls']) $searchlink = "Search.html?itemtype=".$Itemtype; else $searchlink = "index.php?view=search&item_type=".$Itemtype; if($settings['Safe_Urls']) $comingsoonlink = "UpComing.html?item_type=".$Itemtype; else $comingsoonlink = "index.php?view=upcoming&item_type=".$Itemtype; if($settings['Safe_Urls']) $recently_addedlink = "Recentlyadded.html?item_type=".$Itemtype; else $recently_addedlink = "index.php?view=recently_added&item_type=".$Itemtype; if($settings['Safe_Urls']) $newreleaselink = "NewReleases.html?&item_type=".$Itemtype; else $newreleaselink = "index.php?view=newreleases&item_type=".$Itemtype; if($settings['Safe_Urls']) $top100link = "Top100.html?item_type=".$Itemtype; else $top100link = "index.php?view=top100&item_type=".$Itemtype; if($settings['Safe_Urls']) $recommendationslink = "Recommendations.html?item_type=".$Itemtype; else $recommendationslink = "index.php?view=recommendations&item_type=".$Itemtype; if($settings['Safe_Urls']) $giftcertificatemainlink = "GiftCertificate.html"; else $giftcertificatemainlink = "index.php?view=giftcertificatemain"; if($settings['Safe_Urls']) $buygiftcertificatelink = "BuyGiftCertificate.html"; else $buygiftcertificatelink = "index.php?view=buygiftcertificate"; if($settings['Safe_Urls']) $redeemgiftcertificatelink = "RedeemGiftCertificate.html"; else $redeemgiftcertificatelink = "index.php?view=redeemgiftcertificate"; //Browse Film if($settings['Safe_Urls']) $browsefilmlink = "Films.html"; else $browsefilmlink = "index.php?view=moviemain"; //Browse Game if($settings['Safe_Urls']) $browsegamelink = "Games.html"; else $browsegamelink = "index.php?view=gamemain"; ?> <? $Languageobj1 = new Language('',$DB); if($settings['multi_language'] == 'N') { $LangObj = $Languageobj1->GetDefault(); include("language/".$LangObj->GetLanguagefile()); $langvar = $msg; } else { } $Pageobj = $SiteObj->GetPageObject($xview,$DB); if($Pageobj) { // Common metadata $page_title = $Pageobj->GetPagetitle(); $meta_keywords = $Pageobj->GetMetakeywords(); $meta_description = $Pageobj->GetMetadesc(); } else { // Common metadata $page_title = "Game Rental"; $meta_keywords = "Sport,Bets,Odds,Bookmakers,Lotto,Sportsbook,Bettings,Games,Fixture,sportsbook, online Lotto, sports betting, horse racing,football , online betting, online sportsbook, betting odds"; $meta_description = "$site_name is a Online Sports Betting Site.Users can Make bets on all gam,es available and can win money.He can also play Lotto games."; } //platformlinks $PlatFormObj1 = new Platform('', $DB); $PlatFormObj = $PlatFormObj1->GetAll(); $platformlinks = ""; foreach($PlatFormObj as $ObjPlatform) { if($settings['Safe_Urls']) { $platformlink = "Platform/GameCatelog/".$ObjPlatform->GetPlatformid()."_".$ObjPlatform->GetTitle().".html"; } else { $platformlink = "index.php?view=catalog&pfid=".$ObjPlatform->GetPlatformid(); } $platformlinks .= "<a href='".$platformlink."'>".$ObjPlatform->GetTitle()."</a> | "; } //site box $Boxes1 = new DesignBox('', $DB); $leftBoxes = $Boxes1->GetAllLeftBox($Pageobj->GetPageid()); $RightBoxes = $Boxes1->GetAllRightBox($Pageobj->GetPageid()); //sitelayout switch($settings["LayoutSiteWidth"]){ case "100" : $site_width = "100%"; $site_align = "center"; $stylesite = "margin-left:0px;margin-right:0px;"; break; case "1024c" : $site_width = "960px"; $site_align = "center"; $stylesite = "margin-left:auto;margin-right:auto;"; break; case "1024l" : $site_width = "960px"; $site_align = "left"; $stylesite = "margin-left:0px;margin-right:0px;"; break; case "800c" : $site_width = "777px"; $site_align = "center"; $stylesite = "margin-left:auto;margin-right:auto;"; break; case "800l" : $site_width = "777px"; $site_align = "left"; $stylesite = "margin-left:0px;margin-right:0px;"; break; } //skin include("skins/".$settings['CurrentSkin']."/index.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891830 Share on other sites More sharing options...
onthespot Posted August 6, 2009 Share Posted August 6, 2009 I think he is referring to your php tags. Rather than using <?php ?>, you are using short tags <? ?> Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891833 Share on other sites More sharing options...
wildteen88 Posted August 6, 2009 Share Posted August 6, 2009 You will need to edit your php.ini file and enable short tags. Open you php.ini and find the following line short_open_tag = off and set it to on, like so short_open_tag = on Save php.ini Now restart Apache. Your code should now be parsed. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891836 Share on other sites More sharing options...
nlandgraf Posted August 6, 2009 Author Share Posted August 6, 2009 Now I get the following message when I view the page. How do I get around this? Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'usrnick.db.4719269.hostedresource.com' (10060) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Site 1\webmyne\config.inc.php on line 31 1Can't connect to MySQL server on 'usrnick.db.4719269.hostedresource.com' (10060) Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891846 Share on other sites More sharing options...
wildteen88 Posted August 6, 2009 Share Posted August 6, 2009 PHP is unnable to connect to your websites database server.Your host may not allow external connections to mysql. You're be better of performing a database dump on your host and transfering your database locally. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891850 Share on other sites More sharing options...
nlandgraf Posted August 6, 2009 Author Share Posted August 6, 2009 PHP is unnable to connect to your websites database server.Your host may not allow external connections to mysql. You're be better of performing a database dump on your host and transfering your database locally. I don't want to connect to the database. What I would like to be able to do is to view the cosmetic changes I have made to the website without connecting if possible. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891858 Share on other sites More sharing options...
Mardoxx Posted August 6, 2009 Share Posted August 6, 2009 remove any mysql connects then? but then that will break any tables that are created from mysql Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891860 Share on other sites More sharing options...
wildteen88 Posted August 6, 2009 Share Posted August 6, 2009 You wont be able to do that if your website is populated by whats in your database. You have to setup a database locally to be able achieve what you're doing. Quote Link to comment https://forums.phpfreaks.com/topic/169031-preview-php-page-page-script-is-returned/#findComment-891862 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.