Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] it works on localhost but not on hosting account?


[SOLVED] it works on localhost but not on hosting account?

Reply
  #1 (permalink)  
Old 03-30-08, 10:40 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy [SOLVED] it works on localhost but not on hosting account?

Hello all

im new to php and smarty

I have developed a wedsite using these and on my localhost the script works fine no errors in my logs and when testeing all the functions, it works great.

I ftp all my files to my host and now all i get is a blank page. This is realy frustrating as i cannot find any errors in the code. there is also no errors in the logs of my hosting account which is even more frustrating.

i was realy hoping i could get some help, im not sure what information you will need but here's a short breakdown

My comp:
O.S windows vista business
Apache
PHP5
mysql

code written in php using smarty templates. The website worked previously on the hosting account when i put it on to test i took it off changed nothing put it back on and the problem started.

Please help someone ! this has been the 3rd week of trying to debug and my foot is comming closer to the comp.

I have also put smarty into my public html. Was this right?

Im realy desperate!

Thanks all look forward to the reply (ok anticapate)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-30-08, 10:45 AM
j-a-m-i-n's Avatar
j-a-m-i-n j-a-m-i-n is offline
Newbie Coder
 
Join Date: Oct 2006
Posts: 85
Thanks: 0
Thanked 1 Time in 1 Post
Hi,

I'm no expert and I apologise if this undermines you.

Are the locations in your script set to local locations instead of global and if they are relative, are they now relative to some other location now that they are on the server?

Are you using code that is unsupported by your server's php version but is supported locally?

Just my thoughts,
Ben

Last edited by j-a-m-i-n; 03-30-08 at 10:46 AM. Reason: locatio nnow --> location now
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-30-08, 10:46 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
If you are just gettin blank pages, it sounds like you are having problems with errors stopping the script. At the top of your script, put the line
PHP Code:

error_reporting(E_ALL);
ini_set('error_reporting'E_ALL); 
That should display the errors you are getting. If that doesnt show, then it is more than likely problems with the file structure differences. Also, check that both systems have the same PHP version (5)

Jay
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-30-08, 10:50 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Spin

here's some code!

this is index.php
PHP Code:

<?php 

// load Smarty library and config files                                                
require_once 'include/app_top.php';
/* if not visiting a product page, save the link to the current page 
   in the PageLink session variable; it will be used to create the 
   Continue Shopping link in the product details page and the links 
   to product details pages */
if (!isset($_GET['ProductID']) && !isset($_GET['CartAction']))
  
$_SESSION['PageLink'] = "http://" $_SERVER['SERVER_NAME'] .
  
":" $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
  
//load business tier
require_once SITE_ROOT '/business_objects/bo_catalog.php';
require_once 
SITE_ROOT '/business_objects/bo_shopping_cart.php';
require_once 
SITE_ROOT '/business_objects/bo_customer.php';
// Load Smarty template file                                                           
$page = new Page();
$pageContentsCell "first_page_contents.tpl";
$categoriesCell "blank.tpl";
// Load department details if visiting a department
if (isset($_GET['DepartmentID']))
{
    
$pageContentsCell "department.tpl";
    
$categoriesCell "categories_list.tpl";
}
if (isset(
$_GET['Search']))
    
$pageContentsCell="search_results.tpl";
if (isset(
$_GET['ProductID']))
    
$pageContentsCell "product.tpl";
if (isset(
$_GET['CartAction']))
{
    
$pageContentsCell "shopping_cart.tpl";
    
$cartSummaryCell "blank.tpl";
}
else
    
$cartSummaryCell "cart_summary.tpl";
    
// customer accounts functionality
$bo_customer = new BoCustomer();
if (
$bo_customer->IsAuthenticated()) 
  
$customerLoginOrLogged="customer_logged.tpl";
else    
  
$customerLoginOrLogged="customer_login.tpl";
if (isset(
$_GET['RegisterCustomer']) || isset($_GET['ChangeDetails']))
  
$pageContentsCell="customer_details.tpl";
if (isset(
$_GET['AddOrChangeAddress'])) 
  
$pageContentsCell="customer_address.tpl";
if (isset(
$_GET['AddOrChangeCreditCard']))                                                     
  
$pageContentsCell="customer_credit_card.tpl";


 
$page->assign("customerLoginOrLogged",$customerLoginOrLogged);

$page->assign("cartSummaryCell"$cartSummaryCell);
$page->assign("pageContentsCell"$pageContentsCell);
$page->assign("categoriesCell"$categoriesCell);
$page->display('index.tpl');
//Load app_bottom which closes the database connection
require_once 'include/app_bottom.php';                                                           
?>
this is my database file

PHP Code:

<?php

// reference the PEAR DB library
require_once 'DB.php'//i have referenced the correct path for hosting account

//class providing generic data access functionality
class DbManager
{
    public 
$db;
//open database connectionin the constructor
function __construct($connectionString)
{
    
$this->db DB::connect($connectionString,
                        
'USE_PERSISTENT_CONNECTIONS');
    if (
DB::isError($this->db))
        
trigger_error($this->db->getMessage(), E_USER_ERROR);
    
$this->db->setFetchMode(DB_FETCHMODE_ASSOC);
}
// close connection
    
public function DbDisconnect()
    {
        
$this->db->disconnect();
    }
    public function 
DbQuery($queryString)
    {
        
$result $this->db->query($queryString);
        
    }
// wrapper class for PEAR DB's getAll() method  
  
public function DbGetAll($queryString)          
  {                                               
    
$result $this->db->getAll($queryString);    
    if (
DB::isError($result))                     
       
trigger_error($result->getMessage(), E_USER_ERROR);
    return 
$result;                               
  }    
  
// wrapper class for PEAR DB's getRow() method
  
public function DbGetRow($queryString)
  {     
    
$result $this->db->getRow($queryString);
    if (
DB::isError($result))
       
trigger_error($result->getMessage(), E_USER_ERROR);
    return 
$result;
  }     
  
// wrapper class for PEAR DB's getOne() method
  
public function DbGetOne($queryString)
  {     
    
$result $this->db->getOne($queryString);
    if (
DB::isError($result))
       
trigger_error($result->getMessage(), E_USER_ERROR);
    return 
$result;
  }     
 
// wrapper class for the escapeSimple() method                        
  
public function DbEscapeSimple($string)                               
  {                                                                     
    if (
get_magic_quotes_gpc())                                         
      return 
$string;                                                   
    else                                                                
      return 
$this->db->escapeSimple($string);                          
  }                                                                       
                       
                    
}                                                 
?>
and my config file

PHP Code:

<?php        

// SITE_ROOT contains the full path to the tshirtshop folder
define("SITE_ROOT"dirname(dirname(__FILE__)));
// Settings needed to configure the Smarty template engine
define("SMARTY_DIR"SITE_ROOT."/libs/smarty/");
define("TEMPLATE_DIR"SITE_ROOT."/templates");
define("COMPILE_DIR"SITE_ROOT."/templates_c");
define("CONFIG_DIR"SITE_ROOT."/configs");
// these should be true while developing the web site        
define("IS_WARNING_FATAL"true);                            
define("DEBUGGING"true);                                   
// settings about mailing the error messages to admin        
define("SEND_ERROR_MAIL"false);                            
define("ADMIN_ERROR_MAIL""some@email");          
define("SENDMAIL_FROM""some@email");            
ini_set("sendmail_from"SENDMAIL_FROM);                     
// by default we don't log errors to a file                  
define("LOG_ERRORS"false);                                 
//define("LOG_ERRORS_FILE", "c:\\tshirtshop\\errors_log.txt"); // Windows
// define("LOG_ERRORS_FILE", "/var/tmp/tshirtshop_errors.log"); // Unix
// Generic error message to be diplayed instead of debug info
// (when DEBUGGING is false)                                 
define("SITE_GENERIC_ERROR_MESSAGE""<h2>TShirtShop Error!</h2>");
//include path to enable PEAR DB
if ((substr(strtoupper('PHP'-'OS'), 03)) == "WIN")
    
define("PATH_SEPARATOR"";");

ini_set('include_path'SITE_ROOT '/libs/pear/' // again corrected for host
        
PATH_SEPARATOR ini_get('include_path'));
        
//datbase login info
        
define("USE_PERSISTANT_CONNECTIONS""true");
        
define("DB_SERVER""something");
        
define("DB_USERNAME""something");
        
define("DB_PASSWORD""password");
        
define("DB_DATABASE""something");
        
define("MYSQL_CONNECTION_STRING""mysql://" DB_USERNAME ":" .
            
DB_PASSWORD "@" DB_SERVER "/" DB_DATABASE);
// Configure product display options
define("SHORT_PRODUCT_DESCRIPTION_LENGTH",130);
define("PRODUCTS_PER_PAGE",4);
// minimum word length for searches; this constant must be kept in sync
// with the ft_min_word_len MySQL variable                        
define("FT_MIN_WORD_LEN",4);
// shopping cart item types                                         
define("GET_CART_PRODUCTS",1);                                      
define("GET_CART_SAVED_PRODUCTS",2); 
// cart actions                                                     
define("ADD_PRODUCT",1);                                            
define("REMOVE_PRODUCT",2);                                         
define("UPDATE_PRODUCTS_QUANTITIES",3);                             
define("SAVE_PRODUCT_FOR_LATER",4);                                 
define("MOVE_PRODUCT_TO_CART",5);
// admin login info
define("ADMIN_USERNAME""something");
define("ADMIN_PASSWORD""something");
// random value used for hassing
define("HASH_PREFIX""K1-");
// constant definitions for commerce lib classes
define("COMMERCELIB_DIR"SITE_ROOT "/business_objects/commerce_lib/");
define("NEWLINE""\n");
// constant definitions for order handling related messages
define("ADMIN_EMAIL","some@email");
$admin_email_params=array('host' => 'some@email'
                          
'auth' => true,
                          
'username' => 'some@email',
                          
'password' => 'password'); 
define("CUSTOMER_SERVICE_EMAIL","some@email");
$customer_service_email_params = array('host' => 'some@email'
                                       
'auth' => true,
                                       
'username' => 'some@email',
                                       
'password' => 'password'); 
define("ORDER_PROCESSOR_EMAIL","bpike@blankcanvas-art.co.uk");
$order_processor_email_params = array('host' => 'some@email'
                               
'auth' => true,
                               
'username' => 'some@email',
                               
'password' => 'password'); 
define("SUPPLIER_EMAIL","some@email");
define("DATACASH_DIR"SITE_ROOT "/business_objects/datacash_lib/");
?>
Thanks all further info if you require also my hosting account uses linux system which is prob a big problem i think.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-30-08, 10:53 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the quick replies i didnt mention that i had an error reporting file that catches all of the errors and displays them (usualy) hope the code is of use to someone
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 03-30-08, 10:56 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
and we are using the same php5

What is ment by the file structure do you mean the php config and or server config
sorry about lack of knowledge in this but im really new to php
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 03-30-08, 10:58 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by myslowquietlife View Post
my hosting account uses linux system which is prob a big problem i think.
If both are using apache and the same version of php, it shouldnt make a difference whatsoever really. Another thing to check is the file permissions. The file structure is the path to each file, ie on your localhost it will be something like C:\server\public\ whereas on your linux machine it will be something like /home/username/public_html/ so you need to make sure that you have all of them set relative to each other correctly
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 03-30-08, 11:03 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
mmm i did think this aswell and went through all my code and changed paths to the absolute locations and i realy thought this was going to be the problem thing is it made no difference what so ever.
the thing im finding most frustrating is the lack of errors im getting is it possible that if there is a syntax error and i have an error handler and hosting account has log files i get nothing its incredible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 03-30-08, 11:05 AM
j-a-m-i-n's Avatar
j-a-m-i-n j-a-m-i-n is offline
Newbie Coder
 
Join Date: Oct 2006
Posts: 85
Thanks: 0
Thanked 1 Time in 1 Post
Looks like you're jumping straight in at the deep end then, by using classes.

Absolute paths in your script e.g. pointing to http://domain.com/script.php will work regardless of where the script is being hosted (locally or on the server) as it points directly to the file.

If you used a link to /script.php on your server it would equate to http://domain.com/script.php whereas on your desktop or root of your hard drive locally (depending what folder(s) the script was stored in locally).

If you didn't know about relative and absolute linking, you may be trying to do too much too early on in your php learning curve..

Ben
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 03-30-08, 11:05 AM
myslowquietlife's Avatar
myslowquietlife myslowquietlife is offline
Newbie Coder
 
Join Date: Mar 2008
Location: London
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
sorry i know im going on a bit, i also defined the path seperators and defined other things incase the hosting provider uses a unix flavor and again nothing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cPanel/Fantastico/RVSkin Web Hosting starting at ONLY $3.95 /mo - FREE SETUP! WireNine.com General Advertisements 0 10-26-05 05:39 PM
10 Steps to starting a web hosting company. A "must read" for resellers! vortech General Advertisements 0 07-15-05 05:13 PM
Hosting Account Until You DIE icanx General Advertisements 2 02-23-05 05:42 PM
PHP5 Hosting account for FREE w/ any purchase! mxhub General Advertisements 0 10-07-04 12:52 PM


All times are GMT -5. The time now is 01:33 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.