Jump to content


Corporate Sponsors


Latest News: (loading..)

Parse Error at installation


9 replies to this topic

#1 The Wilton Group

  • Community Member
  • 9 posts
  • Real Name:Richard T. Wilton II

Posted 16 July 2010, 03:13

So I unzip and upload all the files to my root directory, then navigate to the install directory and get this error:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/19/d218360750/htdocs/admin/includes/classes/language.php on line 20

I have tried to re upload all the files and get the same error. Last year I sucessfully uploaded oscommerce to this same domain.

#2 blackwater

  • Community Member
  • 163 posts
  • Real Name:Paul

Posted 17 July 2010, 12:17

View PostThe Wilton Group, on 16 July 2010, 03:13, said:

So I unzip and upload all the files to my root directory, then navigate to the install directory and get this error:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/19/d218360750/htdocs/admin/includes/classes/language.php on line 20

I have tried to re upload all the files and get the same error. Last year I sucessfully uploaded oscommerce to this same domain.

Upload your files to the server in a compressed format and then uncompress it.

#3 ravimul

  • Community Member
  • 11 posts
  • Real Name:Simon

Posted 17 July 2010, 17:00

View Postblackwater, on 17 July 2010, 12:17, said:

Upload your files to the server in a compressed format and then uncompress it.

this may sound dumb but how do you uncompress a zip file on a server? thanks.

#4 blackwater

  • Community Member
  • 163 posts
  • Real Name:Paul

Posted 17 July 2010, 22:03

If you lack root access then this is generally done via cpanel or similar. You could also ask your host to do it for you.

#5 thewooly1

  • Community Member
  • 6 posts
  • Real Name:dave henderson

Posted 23 July 2010, 13:20

hi i have same prob i have up loaded the zip file and unziped it on the sever then run the install.php and still get the error

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/sites/hendycrafts.co.uk/public_html/1/oscommerce-3.0a5/oscommerce/admin/includes/classes/language.php on line 20

#6 MrPhil

  • Community Member
  • 3,291 posts
  • Real Name:Phil
  • Gender:Male

Posted 23 July 2010, 18:41

So what do lines 10 through 25 look like in the file? Cut and paste here. Indicate which is line 20. If it's not human readable, obviously something was done wrong somewhere (failed to unpack the file properly).

#7 thewooly1

  • Community Member
  • 6 posts
  • Real Name:dave henderson

Posted 24 July 2010, 00:49

hi here is the fisrt bit of the language.php

*/

require('../includes/classes/language.php');

class osC_Language_Admin extends osC_Language {

/* Public methods */
public function loadIniFile($filename = null, $comment = '#', $language_code = null) {
if ( is_null($language_code) ) {
$language_code = $this->_code;
}

if ( $this->_languages[$language_code]['parent_id'] > 0 ) {
$this->loadIniFile($filename, $comment, $this->getCodeFromID($this->_languages[$language_code]['parent_id']));
}

if ( is_null($filename) ) {
if ( file_exists('includes/languages/' . $language_code . '.php') ) {
$contents = file('includes/languages/' . $language_code . '.php');
} else {
return array();
}
} else {
if ( substr(realpath('includes/languages/' . $language_code . '/' . $filename), 0, strlen(realpath('includes/languages/' . $language_code))) != realpath('includes/languages/' . $language_code) ) {
return array();
}

if ( !file_exists('includes/languages/' . $language_code . '/' . $filename) ) {
return array();
}

$contents = file('includes/languages/' . $language_code . '/' . $filename);
}

$ini_array = array();

foreach ( $contents as $line ) {
$line = trim($line);

$firstchar = substr($line, 0, 1);

if ( !empty($line) && ( $firstchar != $comment) ) {
$delimiter = strpos($line, '=');

if ( $delimiter !== false ) {
$key = trim(substr($line, 0, $delimiter));
$value = trim(substr($line, $delimiter + 1));

$ini_array[$key] = $value;
} elseif ( isset($key) ) {
$ini_array[$key] .= trim($line);
}
}
}

unset($contents);

$this->_definitions = array_merge($this->_definitions, $ini_array);
}

public function injectDefinitions($file, $language_code = null) {
if ( is_null($language_code) ) {
$language_code = $this->_code;
}

if ( $this->_languages[$language_code]['parent_id'] > 0 ) {
$this->injectDefinitions($file, $this->getCodeFromID($this->_languages[$language_code]['parent_id']));
}

foreach ($this->extractDefinitions($language_code . '/' . $file) as $def) {
$this->_definitions[$def['key']] = $def['value'];
}
}

public function &extractDefinitions($xml) {
$definitions = array();

if ( file_exists(dirname(__FILE__) . '/../../../includes/languages/' . $xml) ) {

#8 blackwater

  • Community Member
  • 163 posts
  • Real Name:Paul

Posted 24 July 2010, 03:45

You're probably using an incompatible version of php. Check the requirements on the download page for the product and compare them to your platform.

#9 thewooly1

  • Community Member
  • 6 posts
  • Real Name:dave henderson

Posted 24 July 2010, 07:48

hi and thx for ur help i was run PhP 4 so upgrades to PhP 5 and everything is ok now thankyou :D

#10 bradybarrows

  • Community Member
  • 181 posts
  • Real Name:Brady Barrows

Posted 19 August 2010, 23:00

The problem is resolved by simply putting an .htaccess file with this code:

AddType x-mapp-php5 .php

into the top level of the folder

Fixes it. At least on 1&1 servers this is required.

Edited by bradybarrows, 19 August 2010, 23:01.