WampServer + JavaScript syntax error
Posted by: roycable (---.eburwd5.vic.optusnet.com.au)
Date: May 01, 2008 06:31AM

Hi All,

I have a strange problem and really hope someone can help.

I seem to be having a problem with WampServer parsing the Prototype Javascript file.
When I open a simple PHP file with a <script ... > tag loading in prototype.js, Firebug tells me there's a syntax error in prototype.js.

Now, when I change the PHP file to a .htm, and load in the file through file:///C:/... etc, NO errors are shown.

Furthermore, when I upload the PHP version to a web server, and view it via a browser, again, NO errors.

This is why I believe the problem lies with WampServer's parsing (as apposed to the .js file).

I was a user of Wamp2 a year or so ago, and the scripts I used/created then (using prototype) are now producing errors under WampServer.

More specifically, firebug tells me the error inside prototype.js is at line 2495.


Just incase...
<html>
<head>
	<script type="text/javascript" src="prototype.js"></script>
</head>

<body>
Test
</body>
</html>

Any suggestions?

Although I still have the installation file of Wamp2, I'm after PHP5 which it doesn't have.

Please help!

Thanks in advance,
Roy

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: roycable (---.eburwd5.vic.optusnet.com.au)
Date: May 01, 2008 08:34AM

Ok, so here's what I've been able to do, and work out.

I took the prototype.js file (which was about 4000 lines) and split it up into 4 smaller files (1000~ lines each), included them all individually with <script... > and all seems fine now.

So it'd be safe to conclude that WampServer seems to struggle passing in js files over a certain amount of lines (in my case, at the 2495 mark).

Can anyone else confirm this with their own similar problems?

Perhaps a work around? Is it WampServer not receiving enough resources to load in the whole original JS?

Although this is a solution, I wouldn't like to think this was a final solution.

So at this stage, this is semi-resolved.

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: stevenmartin99 (212.129.94.---)
Date: May 01, 2008 04:20PM

there are setting in http.conf and apacheforphp.ini that allow bigger scripts. Its measured in memory not lines. Im on bus. Wen i get home ill most it up

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: roycable (---.eburwd5.vic.optusnet.com.au)
Date: May 01, 2008 11:29PM

Hi Steven,

Thanks for getting back to me.

I've got 'memory_limit = 128M' already set, and couldn't find any other setting that might help.

I'll wait till you get home.

Cheers!

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 02, 2008 04:09PM

can u tell me what size ur file is?


iv tryed a js scrpit with 100000 lines with no error


can u send me the js file to my gmail email below?

and ur sure this onl;y happens when the file name of the page calling it is php? and it works fine wen its html?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: roycable (---.eburwd5.vic.optusnet.com.au)
Date: May 03, 2008 03:07PM

The javascript file I had trouble with was prototype.js (http://www.prototypejs.org/), but I highly doubt this was the problem as after splitting up the file into 4 smaller files (and not actually altering the javascript), I no longer had problems.

The same problem was occuring when trying to use TinyMCE in my site.

I've moved on to an alternative to WampServer and am no longer having trouble - shame though, I really liked WampServer.

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: astropoint (---.range86-130.btcentralplus.com)
Date: June 23, 2008 11:47AM

I would like to add that I have been getting exactly the same issue with the prototype.js file when hosted on wamp. When the file is served up to the browser there appear to be an extra 50 lines or so added randomly into the middle of the file which messes up the whole thing. hosting the files on another web server works perfectly well, so I agree it has to be some issue with wamp.

roycable Wrote:
-------------------------------------------------------
> The javascript file I had trouble with was
> prototype.js (http://www.prototypejs.org/), but I
> highly doubt this was the problem as after
> splitting up the file into 4 smaller files (and
> not actually altering the javascript), I no longer
> had problems.


Thankyou for that though, it would never have occured to me to try doing that and it does make it work as normal for some reason.

I would like to continue using wamp if possible so was wondering if anybody has any ideas what could be causing it, or what to do to try to fix it?

Many thanks

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: dvnitycker (95.180.43.---)
Date: May 06, 2010 01:00PM

2 years later this error persists. prototype breaks for me when using it with wampserver. problem doesn't manifest with xampp. I have Win 7

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: tielenaar (---.ip.telfort.nl)
Date: November 10, 2010 03:51AM

Same problem. I have this issue with jQuery, not tested prototype, but this sounds exactly like what I have.
Splitting up the file into smaller chunks did not help. Even without the use of PHP and just using html+js files i get errors, when running them from a file:/// perspective they do work, but with the same files moved to the www folder I get these transfer errors.

The weirdest thing is that it used to work fine, but one day this issue started occurring. I reinstalled Wamp Server to the latest version, but nothing changed. I'm running Win XP (still).

I tried changing memory and buffer sizes in the config files, but that didn't help either. A reinstall of windows 'might' work, although i doubt windows is the cause of it. I shall try installing wamp on another machine and see if the problem is the same there.

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: tielenaar (---.ip.telfort.nl)
Date: November 10, 2010 04:21AM

Jup, my other xp machine works fine.. same config.. must be my xp install that's screwed up then, ah well, time for win7 anyway.

Options: ReplyQuote
Re: WampServer + JavaScript syntax error
Posted by: apro (61.245.168.---)
Date: January 24, 2012 02:05AM

I have a wampserver 2.3 version.When i run javascript files in this server It show the program code not the result.What is the reason?How can i fix this?

<html>
<body>
<script type="text/javascript">
var visitor="PRESS";
var greeting=(visitor="PRESS"winking smiley?"Dear President ":"Dear";
document.write(greeting);</script>
</body></html>

Options: ReplyQuote


Sorry, only registered users may post in this forum.