Jump to content

[SOLVED] unexpected $end - Server has lower version of PHP then my localhost


MasterACE14

Recommended Posts

Hey Everyone,

 

I keep getting

Parse error: syntax error, unexpected $end in /home/ace/public_html/darkdestiny/adodb/adodb.inc.php on line 428
when using ADOdb(used for connecting to different types of databases, im using it for mysql) on my webhost, but it works completely fine on my localhost, now the problem is, my localhost runs the latest version of PHP, but my webhost uses version 4.7.7 and thus seems to be creating this parse error.

 

Now I am fairly confident there is a way, or function that can force a script to run in a lower version of PHP, could someone supply me with this function or a sample script to force the version.

 

any and all help is greatly appreciated  :)

 

Regards ACE

Link to comment
Share on other sites

I'll echo what AndyB just posted. This is due to a php configuration difference and has nothing to do with php versions. It is probably due to short open tags being used in your code.

 

When this error occurs when the only thing that changed is a different server, then it is probably due to a block of php code that is using short open tags that contains the missing }. When the server does not recognize the <? tag then the } that is in that block of code is not seen either.

 

I seriously recommend to anyone that is using the lazy-way short open tags <? or <?= to change these to <?php and <?php echo to avoid problems.

 

 

Link to comment
Share on other sites

I'll echo what AndyB just posted. This is due to a php configuration difference and has nothing to do with php versions. It is probably due to short open tags being used in your code.

 

When this error occurs when the only thing that changed is a different server, then it is probably due to a block of php code that is using short open tags that contains the missing }. When the server does not recognize the <? tag then the } that is in that block of code is not seen either.

 

I seriously recommend to anyone that is using the lazy-way short open tags <? or <?= to change these to <?php and <?php echo to avoid problems.

 

 

 

open tags isn't a problem with this script.

 

Try to attach the file and let us take a look.

 

heres the area around the line it says the error is on(sorry cant attach it  :-\ ):

<?php	
function Connect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "", $forceNew = false) 
{
	if ($argHostname != "") $this->host = $argHostname;
	if ($argUsername != "") $this->user = $argUsername;
	if ($argPassword != "") $this->password = $argPassword; // not stored for security reasons
	if ($argDatabaseName != "") $this->database = $argDatabaseName;		

	$this->_isPersistentConnection = false;	
	if ($forceNew) {

/* line PHP has a problem with */ if ($rez=$this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
	} else {
		 if ($rez=$this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
	}
	if (isset($rez)) {
		$err = $this->ErrorMsg();
		if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
		$ret = false;
	} else {
		$err = "Missing extension for ".$this->dataProvider;
		$ret = 0;
	}
	if ($fn = $this->raiseErrorFn) 
		$fn($this->databaseType,'CONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);


	$this->_connectionID = false;
	if ($this->debug) ADOConnection::outp( $this->host.': '.$err);
	return $ret;
}	
?>

 

Regards ACE

Link to comment
Share on other sites

It was a long time ago so I don't remember the actual error, however I had extra blank lines after my closing tags and the server started trippin and I had to delete all extra space and lines, I think that was something to do with 'end'... maybe worth a try?

Link to comment
Share on other sites

I just went and downloaded the latest ADOdb compatible for PHP 4 and 5, and uploaded all the files,

Either one or more of the files that are part of the adodb package got truncated/corrupted when they were uploaded to the server or something in your main file that is including the adodb.inc.php file is causing the error.

 

5 of the files weren't fully uploaded and I was notified by FileZilla.

 

I then created a basic upload.php file to upload the 5 files(and not setting a file size restriction) and that seemed to upload the complete files. But I am still getting a $end, but now it is at line 1663.

 

any ideas??

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.