Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Getting a parse error after moving oscommerce from remote to xampp environment?


jaatendi

Recommended Posts

After moving my project into xampp and updating the two configure.php files, I am now getting this error when I view the project in a browser:

 

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\signifimobile-ca\index.php on line 340

 

My index file has 339 lines. I removed the .htaccess file. Any idea what the problem is, and how I can fix this?

 

thanks

Link to comment
Share on other sites

@@jaatendi

 

Did you edit the index.php file with a WYSIWYG editor ? You should only edit PHP files with a text editor such as Notepad+ and Editplus+. WYSIWYG editors may leave hidden formatting in the files.

 

 

 

 

Chris

Link to comment
Share on other sites

Is your xampp version running PHP 5.4 by any chance and are you using any short tags <? to start PHP code in your files? If yes, then this could explain it as short tags are not allowed anymore in PHP 5.4. You have to change all occurences of <? to <?php

 

Thomas

Link to comment
Share on other sites

There don't seem to be any <? tags in stock osC 2.3.3. Perhaps in an add-on...

 

A vanilla osC 2.3.3 /catalog/index.php is 276 lines, so I would presume that you've installed some add-ons or otherwise done some editing to get 339 lines. Any hand editing done?

 

An unexpected EOF is usually caused by a missing closing ) ] or (most often) } at some point in the code. Does your index.php file appear to have been cut off in the middle of something? Does it end with a } followed by maybe some blank lines and then a ?> ?

 

By the way, I strongly recommend against using *AMPP installations to work on a site. There's almost always some difference in the PHP level, MySQL level, or Apache (not to mention different configurations) that will cause all sorts of headaches moving sites from one to the other. You may get it working perfectly on your PC, and then spend many hours figuring out why it's not working on a live server. My recommendation is to create a sandbox in a private directory (no links to it) and install password protection on it. Copy your active site and database to the new one, and play with it to your heart's content, secure in the knowledge that whatever you do, it will work exactly the same way when you go live with it.

Link to comment
Share on other sites

@ MrPhil

 

Well, the original poster said he updated some files, so it might not be the original osC code anymore.

 

My statement above was actually not quite correct: The short tag as such works in PHP 5.4 but not if you use <? } ?> which creates the said error message (whether or not short tags are enabled in php.ini). I am not sure whether this is intended behaviour or whether it is a bug. I only became of aware of this when I had the same proplem when trying to run our (heavily modified) shopping cart under PHP 5.4. The problem was resolved by changing all occurences of <? } ?> to <?php } ?>

 

Thomas

Link to comment
Share on other sites

I don't know how it happened but out of nowhere an errant ?> is appearing on all pages just below header.php and above column_left.php......checked for syntax errors no errors found either file.

 

Thanks in advance any advice I am not a qualified code writer and a total amateur

Link to comment
Share on other sites

@Thomas789

 

Another correction to my above posts: The error in xampp actually disappears after all if the short tag is enabled in php.int (I forgot to restart the Apache server during my tests). Still you should always use <?php as otherwise you become dependent on the server settings).

 

Thomas

Link to comment
Share on other sites

I don't know how it happened but out of nowhere an errant ?> is appearing on all pages just below header.php and above column_left.php......checked for syntax errors no errors found either file.

 

Thanks in advance any advice I am not a qualified code writer and a total amateur

 

There wouldn't be any PHP error if you add a second closing tag outside the PHP scope. You would just have ?> printed out somewhere in your HTML output.

 

Thomas

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...