parse error message

parse error message

by S. Culhane -
Number of replies: 5
Any assistance anyone can provide on this error would be appreciated:

installing Moodle 1.4.1 -

Parse error: parse error, unexpected T_STRING in /home/.../public_html/....(root).../lib/weblib.php on line 1170

Thanks
Average of ratings: -
In reply to S. Culhane

Re: parse error message

by Janey Layman -

Well, I hate to say it,  but I am getting the SAME error message (at least almost) and am totally befuddled by it.  PLEASE HELP US!!!  I feel really stupid!!!!  Thanks!

Janey

Error message:

Parse error: parse error, unexpected T_ELSE in /home/content/.../html/moodle/lib/weblib.php on line 1203

In reply to Janey Layman

Re: parse error message

by Miriam Scurrah -

Well I must be a champion of stupid, because I get heaps of error messages including parse error messages. I followed all the instructions for Windows and uploaded the easyphp program and then comes the hard bit of editing the config.php file. With absolutely no understanding of code writing I am not even sure where in the text the bits need to go but I thought i had done ok....and then...

Parse error: parse error, unexpected T_VARIABLE in c:\program files\easyphp1-7\www\moodle\config.php on line 104

Notice: Undefined variable: CFG in c:\program files\easyphp1-7\www\moodle\index.php on line 16

Warning: main(/course/lib.php): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\moodle\index.php on line 16

Fatal error: main(): Failed opening required '/course/lib.php' (include_path='.;C:\Program Files\EasyPHP1-7\php\pear\') in c:\program files\easyphp1-7\www\moodle\index.php on line 16

Is there someone out there who can put us out of our misery??? It would be greatly appreciated.

In reply to Miriam Scurrah

Re: parse error message

by Penny Leach -
In your case it looks like when you edited config.php you took a $ off the front of CFG.

Everything should look like
$CFG->foo = 'bar';

NOT

CFG->foo = 'bar';

Also you need to make sure you have ; on the end of each line.

Also, strings all need to be quoted. So things like dbname, etc all need to have quotes

$CFG->dbname = 'moodle';

NOT

$CFG->dbname = moodle;

In reply to S. Culhane

Re: parse error message

by Jim Proctor -
I encountered a parse error today after upgrading via CVS to 1.4.2+; the upgrade (from 1.4.2nearly) went fine, but when I checked in later in the day I encountered the error. The only way I was able to fix it was to do a clean CVS install of Moodle, transfer config.php, theme files, etc. into the clean install directory, and go. (There was apparently no need to upgrade the database as it was successfully done following the CVS upgrade earlier today.)

I noticed lots of miscellaneous parse errors discussed in the Moodle forum here and there, but few replies. It would be good for one of you Moodle experts out there to give us some general info on what these errors mean and how they should be fixed! Thanks.

Jim P.
In reply to Jim Proctor

Re: parse error message

by Penny Leach -
parse errors from stable = bad sad

if you get a parse error, post the exact error you get, along with the contents of the code that the parse error references (with a few lines either side)

so if it says

PARSE ERROR: expected T_ELSE on line 1100 of lib/weblib.php

post say, 5 or 10 lines on either side of 1100 here, with the exact wording of the error message and someone should fix it in cvs.