Jump to content

Recommended Posts

Posted

On any php page i make it returns a 500 error. On my local server and on my friends paid hosting it works fine. The php syntax is correct also. Is php down? That would not make sense because cpanel is running on php. What is going on today?

 

Thanks,

 

Andrew

Posted
On any php page i make it returns a 500 error. On my local server and on my friends paid hosting it works fine. The php syntax is correct also. Is php down? That would not make sense because cpanel is running on php. What is going on today?

 

Thanks,

 

Andrew

 

is your url correct? what does it say in your error logs? do plain html pages work? my site is functioning. hope that helps.

Posted
Everything should be ok now. Are you still getting 500 errors on your php pages?

Yes, i attached a php file that is getting the error.

Removed attachment(contained sensitive info)

 

Thanks,

 

Andrew

Posted
You need to post the url of your page and then post me the php script.

url: http://aq-dev.co.cc/func.php

code:

<?PHP
class SystemComponent {
   var $settings;
   function getSettings() {
       // System variables
       $settings['siteDir'] = '/home/andrewq2/public_html/';
       // Database variables
       $settings['dbhost'] = 'localhost';
       $settings['dbusername'] = 'andrewq2_aqdev';
       $settings['dbpassword'] = '************';
       $settings['dbname'] = 'andrewq2_aqdev';
       return $settings;
   }

}
class DbConnector extends SystemComponent {
var $theQuery;
var $link;
//Function to connect to db
function DbConnector(){
	// load settings from the parrent class
	$settings = SystemComponent::getSettings();
	$host = $settings['dbhost'];
	$db = $settings['dbname'];
	$user = $settings['dbusername'];
	$pass = $settings['dbpassword'];
	//connect to mysql
	$this->link = mysql_connect($host, $user, $pass);
	mysql_select_db($db);
	register_shutdown_function(array(&$this, 'close'));
}
//function to query the db
function query($query){
	$this->theQuery = $query;
	return mysql_query($query, $this->link);
}
//function to fetch the querys results in a array
function fetchArray($result){
	return mysql_fetch_array($result);
}
//return last query for debugging
function getQuery() {
	return $this->theQuery;
}
//return the array as MYSQL_NUM
function getNumRows($result){
	return mysql_num_rows($result);
}
//function to close the connection
function close(){
	mysql_close($this->link);
}
}
class Validator extends SystemComponent{
var $errors;
function validateNumber($theinput,$description = ''){
	if(is_numeric($theinput)){
		return true; //it is a number return true
	}else{
		$this->errors[]=$description;
		return false;// value not numeric return false
	}
}
function validateText($theinput,$description = ''){
	if(is_string($theinput)){
		return true; //it is a number return true
	}else{
		$this->errors[]=$description;
		return false;// value not numeric return false
	}
}
function validateDate($thedate,$description = ''){
	if (strtotime($thedate) === -1 || $thedate == '') {
		$this->errors[] = $description;
		return false;
	}else{
		return true;
	}
}
function validateEmail($theinput,$description = '') {
	if(preg_match('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/',$theinput)){
		return true;
	}else{
		$this->errors[]=$description;
		return false;
	}
}
function foundErrors() {
	if (count($this->errors) > 0){
		return true;
	}else{
		return false;
	}
}
function listErrors($delim = ' '){
	return implode($delim,$this->errors);
}
function addError($description){
	$this->errors[] = $description;
}
}
class sentry {
var $loggedin = false;	
var $userdata;			
function sentry(){
	session_start();
	header("Cache-control: private"); 
}
function logout(){
	unset($this->userdata);
	session_destroy();
	return true;
}
function checkLogin($user = '',$pass = '',$goodRedirect = '',$badRedirect = ''){
	$validate = new Validator();
	$loginConnector = new DbConnector();
	if ($_SESSION['user'] && $_SESSION['pass']){
		if (!$validate->validateText($_SESSION['user'])){return false;}
		if (!$validate->validateText($_SESSION['pass'])){return false;}
		$getUser = $loginConnector->query("SELECT * FROM users WHERE user = '".$_SESSION['user']."' AND pass = '".$_SESSION['pass'].' AND enabled = 1');
		if ($loginConnector->getNumRows($getUser) > 0){
			if ($goodRedirect != '') { 
				header("Location: ".$goodRedirect."?".strip_tags(session_id())) ;
			}			
			return true;
		}else{
			$this->logout();
			return false;
		}
	}else{	
		if (!$validate->validateTextOnly($user)){return false;}
		if (!$validate->validateTextOnly($pass)){return false;}
		$getUser = $loginConnector->query("SELECT * FROM users WHERE username = '$user' AND password = PASSWORD('$pass') AND enabled = 1");
		$this->userdata = $loginConnector->fetchArray($getUser);
		if ($loginConnector->getNumRows($getUser) > 0){
			$_SESSION["user"] = $user;
			$_SESSION["pass"] = $this->userdata['pass'];
			$_SESSION["thegroup"] = $this->userdata['thegroup'];
			if ($goodRedirect) { 
				header("Location: ".$goodRedirect."?".strip_tags(session_id())) ;
			}
			return true;
		}else{
			unset($this->userdata);
			if ($badRedirect) { 
				header("Location: ".$badRedirect) ;
			}		
			return false;
		}
	}			
}
}
?>

Posted

I was able to run that script without any errors. Check your file permissions for me and also try this piece of code for me:

 

<?php phpinfo(); ?>

 

just call it 'info.php'

 

 

 

That's not a 500 Error, that's a 403 Forbidden. Check your htaccess.

 

 

Posted
I was able to run that script without any errors. Check your file permissions for me and also try this piece of code for me:

 

<?php phpinfo(); ?>

 

just call it 'info.php'

 

 

 

That's not a 500 Error, that's a 403 Forbidden. Check your htaccess.

Ran it still 500 error, and i have no .htaccess also i changed the permissions to 755 same error.

Posted

Make sure you set ALL of your php pages and html pages to 644 as file permissions. Since you say you don't have an htaccess file, go to your cpanel and look for the link that says FrontPage Extensions and click uninstall.

 

Posted
Make sure you set ALL of your php pages and html pages to 644 as file permissions. Since you say you don't have an htaccess file, go to your cpanel and look for the link that says FrontPage Extensions and click uninstall.

It said it was not installed so i cleaned up the extensions and it recreated a .htaccess file and chmod the files to 644.

Posted
This is pretty weird. Have you installed/done anything recently on your account?

Made subdomain http://joad.aq-dev.co.cc nothing much else

 

Update:

It seams to be working now. Maybe it was the apache restart to add the sub domains that did it, What ever you did thank you. The customer service here is great for free hosting. Most free hosting places the errors don't get elevated to the server owner.

 

Thanks,

 

Andrew

 

Update2:

 

After i started uploading some files i went to test them but i am getting 500 error again..... This problem is going around in loops. Just a suggestion can you remake my account to see if that clears it up.

 

Thanks,

 

Andrew

 

Update3:

 

I just got my php scripts to work again what ever it is it happens randomly. I love this free hosting service but i might have to move to another host if this problem keeps happening.

 

Thanks,

 

Andrew

Guest
This topic is now closed to further replies.
×
×
  • Create New...