Jump to content

Preview PHP page, page script is returned


nlandgraf

Recommended Posts

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?

Link to comment
Share on other sites

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"); ?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");

?>

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.