Jump to content

linardzb

Recommended Posts

Hi,

Im having a nightmare (very newbie to PHP) to display a webpge which changes the title dinamically with PHP scripts that Im sure are correct. Instead it gives me ERROR 500. As well as hosting provider is not sure if my directory structure is correct, again Im very positive it is correct, trying to sort this bugger out for ages. I will add a png file for directory overview. Can someone please have alook at this example: http://www.origin-designs.co.uk/

 

1. All goes wrong when I add this script to my _header.php:

 

<?php
$objBusiness = new Business();
$business = $objBusiness->getBusiness();
?>

 

2. This is Business class script:

 

<?php
class Business extends Application {

private $_table = 'business';

public function getBusiness() {
$sql = "SELECT * FROM `{$this->_table}`
WHERE `id` = 1";
return $this->db->fetchOne($sql);
}



public function getVatRate() {
$business = $this->getBusiness();
return $business['vat_rate'];
}



public function updateBusiness($vars = null) {
if (!empty($vars)) {
$this->db->prepareUpdate($vars);
return $this->db->update($this->_table, 1);
}
}
}

 

will provide you with further information if needed.

 

Many thanks.

 

post-131858-0-93346400-1358810107_thumb.jpg

Edited by linardzb
Link to comment
Share on other sites

A http 500 response code for a php produced page usually means a fatal parse or fatal runtime error. If your code works on your development system, so that we can assume that it doesn't have a fatal parse error, you are likely getting a fatal runtime error.

 

To help debug a runtime error, add the following two lines of code, immediately after your first opening <?php tag, to see what if any php errors are occurring -

 

ini_set("display_errors", "1");
error_reporting(-1);

Link to comment
Share on other sites

A http 500 response code for a php produced page usually means a fatal parse or fatal runtime error. If your code works on your development system, so that we can assume that it doesn't have a fatal parse error, you are likely getting a fatal runtime error.

 

To help debug a runtime error, add the following two lines of code, immediately after your first opening <?php tag, to see what if any php errors are occurring -

 

ini_set("display_errors", "1");
error_reporting(-1);

 

Sorry for dumb question, shall I throw it in index.php or _header.php ? cheers

Edited by linardzb
Link to comment
Share on other sites

This is Directory access code:

 

<?php
if(!isset($_SESSION)) {
session_start();
}
// site domain name with http
defined("SITE_URL")
|| define("SITE_URL", "http://".$_SERVER['SERVER_NAME']);

// directory separator
defined("DS")
|| define("DS", DIRECTORY_SEPARATOR);
// root path
defined("ROOT_PATH")
|| define("ROOT_PATH", realpath(dirname(__FILE__) . DS."..".DS));

// classes folder
defined("CLASSES_DIR")
|| define("CLASSES_DIR", "classes");
// pages directory
defined("PAGES_DIR")
|| define("PAGES_DIR", "pages");
// modules folder
defined("MOD_DIR")
|| define("MOD_DIR", "mod");

// inc folder
defined("INC_DIR")
|| define("INC_DIR", "inc");

// templates folder
defined("TEMPLATE_DIR")
|| define("TEMPLATE_DIR", "template");

// emails path
defined("EMAILS_PATH")
|| define("EMAILS_PATH", ROOT_PATH.DS."emails");

// catalogue images path
defined("CATALOGUE_PATH")
|| define("CATALOGUE_PATH", ROOT_PATH.DS."media".DS."catalogue");

// add all above directories to the include path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(ROOT_PATH.DS.CLASSES_DIR),
realpath(ROOT_PATH.DS.PAGES_DIR),
realpath(ROOT_PATH.DS.MOD_DIR),
realpath(ROOT_PATH.DS.INC_DIR),
realpath(ROOT_PATH.DS.TEMPLATE_DIR),
get_include_path()
)));

Link to comment
Share on other sites

I would try putting the code on my laptop/desktop/whatever pc and use something like WAMP to set up a localhost to do testing, since it sounds like you're using a shared host. 

Edited by Jessica
Link to comment
Share on other sites

Shared hosting:

 

MySQL Server version: 5.0.92-50-log

WebServer: MySQL client version: 5.1.66

 

which provides Info NOTE: Your PHP MySQL library version 5.1.66 differs from your MySQL server version 5.0.92. This may cause unpredictable behavior.

 

Which I checked, and aparently it needs to updated via:

yum update php

 

Local Server:

 

MySQL

Server version: 5.5.8-log

 

WebServer

  • Apache/2.2.17 (Win32) PHP/5.3.5
  • MySQL client version: mysqlnd 5.0.7-dev - 091210

 

Yhank you for the help

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.