Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shop Not Functional After Hosting Change...


TheDukeOfHurl

Recommended Posts

Hello!

I recently switched to a different host and am now unable to get my osCommerce install to function properly. When I attempt to launch it, I receive the following error:

Parse error: syntax error, unexpected '}', expecting '{' in /home/bigmus5/public_html/shop/includes/functions/database.php on line 13

What do I need to change to make this work?

Thanks!

Link to comment
Share on other sites

The error is saying the code is incorrect. That's strange because it should have failed before the move. The fix is to edit that file and change the symbol shown as directed at line 13. It would be better if you posted that line here, with a few lines above and below it, so someone can verify the fix but based on the error, making that change should fix it.

I would be concerned about how the code got changed. Assuming the shop worked prior to the move, someone had to have edited that file, which almost never gets edited.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Here are the first forty lines:

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2013 osCommerce

  Released under the GNU General Public License
*/

  function tep_db_connect($server = 'localhost', $username = 'xyz_shop', $password = 'xyz123abcdef', $database = 'xyz_shop', $link = 'db_link') }
    global $$link;

    if (USE_PCONNECT == 'true') {
      $server = 'p:' . $server;
    }

    $$link = mysqli_connect($server, $username, $password, $database);

    if ( !mysqli_connect_errno() ) {
      mysqli_set_charset($$link, 'utf8');
    } 

    return $$link;

  function tep_db_close($link = 'db_link') {
    global $$link;

    return mysqli_close($$link);
  }

  function tep_db_error($query, $errno, $error) { 
    if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
      error_log('ERROR: [' . $errno . '] ' . $error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
    }

    die('<font color="#000000"><strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>');
  }

Link to comment
Share on other sites

The reason for the failure is that this part

$link = 'db_link') }

should be

$link = 'db_link') {

However, someone has edited that while line to contain your database details. That will break when moving to a new host unless the database details stay the same, which they shouldn't for security reasons. I suggest you replace that whole line with

  function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

Whoever made that change didn't understand how oscommerce works so I would be concerned that they made other such changes. If you paid someone to work on your site, I suggest looking for someone who understands the code.

Also, this post will be seen by hackers and they now have your database login credentials so you need to change those right away.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

It is because the { is in the wrong place. As mentioned in my reply to your PM, you should download the latest version of CE and use the database file from it.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...