Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
04-11-2006, 12:31 PM
|
#16
|
|
Member
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Original Poster
Rep:
|
Yes, yes, yes!!!
That was, actually, my first thought
But I checked through out the code to find the same as you: nothing.
The comment on the include was a comment I put when I was re-checking for problems on the include files. Nothing.
As you said you confirmed it worked on PHP4, It was working before.
Now I'm taking yours and greamef piece of advice: I'm putting the code back little by little to see where's the problem.
I'll keep you posted.
Quote:
|
Originally Posted by Spudley
When you get this error on the last line of your PHP, it usually means that you left something unclosed -- ie mismatched brackets, php tags, or something like that. PHP freaks out because it gets to the end of the program and is expecting more code; it's reporting "unexpected $" because it treats the blank line after the final ?> as a print statement (ie print a carriage return).
As you say, it works in PHP4, and I don't have php5 on my box to test it with. Looking at the code, I can't see anything obviously wrong, but the line <?//include("menu.php");?> makes me wonder if php5 is treating the comment differently, and including the ?> in the comment, in which case, it would definitely cause problems. So maybe try changing that to use /*...*/ comment style instead.
I honestly can't see anything else that would cause problems. Hope you manage to solve it... If all else fails, split it down into bits, and see which one breaks.
All the best.
|
|
|
|
|
04-13-2006, 01:26 AM
|
#17
|
|
Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,861
Rep: 
|
Hi, frandalla -
I'm curious - what did you find?
Please keep us posted!
PS:
I've never had occasion to use it, but I understand that you can modify your php.ini to do some (fairly verbose) logging. Perhaps that might help?
http://us3.php.net/errorfunc
Last edited by paulsm4; 04-13-2006 at 01:27 AM.
|
|
|
|
03-15-2007, 01:02 PM
|
#18
|
|
LQ Newbie
Registered: Mar 2007
Posts: 1
Rep:
|
Hi all,
Old topic, I know - found it via Google since I had the same problem today. I had the same parse-error - without reason! - I was convinced the code was ok.
After trying some things I found the solution (for me at least). The problem is in the whitespaces. In my case for some reason my file was 'polluted' with windows-spaces (CF). I changed all these into unix spaces (LF) and I got rid of the weird parse-errors from PHP.
To convert spaces unix-style:
- open your file with notepad++ (notepad-plus.sourceforge.net) (other editors might also be able to do this)
- Go to > format > convert to unix format.
- save and smile (I hope)
That did the tric for me. Hope this reaction might still be usefull for someone.
Note for beginning PHP-programmers: first check all the points mentioned before! It might actually be a PHP parse error caused by a typo.
|
|
|
|
09-21-2007, 03:11 PM
|
#19
|
|
LQ Newbie
Registered: Sep 2007
Posts: 1
Rep:
|
Hi, I just had a struggle with such an issue. I came up with a following solution. It will help to have Linux, or similar scripting environment and commands to use.
I have "index.php" which I run to make an index.html file. It was this file which I had my error. I decided to create the following script so that I could 'target' my bug.
Code:
#!/bin/csh
foreach length (50 100 150 200 250 )
head -n $length index.php > Xindex.php
echo ---------------------$length-------------------------
php Xindex.php > xxx
end
(BTW The length of my file was 225 lines.)
So I ran this script. It essentially breaks up your code and parses the cut up versions of your code. Different lengths of the file are parsed according to the foreach line in the script. I received this output
Code:
---------------------50-------------------------
---------------------100-------------------------
---------------------150-------------------------
PHP Parse error: parse error, unexpected $ in /d/home/coltharp/public_html/ex/page.builder/Xindex.php on line 151
---------------------200-------------------------
PHP Parse error: parse error, unexpected $ in /d/home/coltharp/public_html/ex/page.builder/Xindex.php on line 201
---------------------250-------------------------
PHP Parse error: parse error, unexpected $ in /d/home/coltharp/public_html/ex/page.builder/Xindex.php on line 224
It just so happened that line 150 was inside a foreach block. So this result did not key me in to my bug. But I continued changing the foreach line in the csh script. Finally I found a place where I had accidentally commented out a closing bracket. Hope this helps!
|
|
|
|
03-06-2008, 04:10 AM
|
#20
|
|
LQ Newbie
Registered: Mar 2008
Posts: 1
Rep:
|
I HAVE A PROBLEM WHAT SHOULD I DO, THE PROBLEM IS THIS WHEN I TRY TO OPEN A SITE THEN THIS COME ON SCREEN:Parse error: parse error, unexpected T_STRING in /hsphere/local/home/nohani/baask.com/diwan/Settings.php on line 28,WHAT IS THE SOLUTION??
Last edited by hamgerench; 03-06-2008 at 04:11 AM.
|
|
|
|
03-06-2008, 05:14 AM
|
#21
|
|
Senior Member
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Etch/Lenny/Squeeze
Posts: 3,785
|
"Unexpected $ on line 59" means that there is an unexpected end of file. '$' is used to indicate end of file. It means that usually a closing '}' is forgotten or a ';'
This is one of the obscure error messages of PHP, no matter how powerful PHP is, the error messages are sometimes obscure. (But you get used to it)
jlinkels
|
|
|
|
03-06-2008, 10:13 AM
|
#22
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
@hamgerench:
If it's not your site, you can't do anything (except informing the webmaster)
Else post the code
PS Whole sentences in caps is considered shouting and is usually not appreciated
|
|
|
|
12-08-2008, 02:37 PM
|
#23
|
|
LQ Newbie
Registered: Dec 2008
Posts: 1
Rep:
|
I read this thread about php parser erros and I too have a .php parser error in the PaymentMethod.php file for my cart:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 133: parser error : Opening and ending tag mismatch: usaepayach line 107 and payach in /home/the/domains/silverborn.com/public_html/lib/Varien/Simplexml/Config.php on line 500
I know that the parsing error exists in the paymentmethod.php file because before I modified the original Adapter Model code, I could access my configuration settings in admin>system>Configuration. Now I have no access to my store’s configuration at all.
I could post the complete .php code but since it’s a payment module, I think it would be best to have someone help me fix it by sending him/her the complete code via private message asap.
Please help me fix this so I can access my configuration settings. I know it's a simple fix but I'm new to php.
Thanks you all,
Leslie
|
|
|
|
03-04-2009, 12:34 PM
|
#24
|
|
LQ Newbie
Registered: Mar 2009
Posts: 1
Rep:
|
It's too late, i know ;)
But things like this happend to me all the time.
Just looking at the source, i see a problem (not so obvious may be): I will quote :
<?php
session_start();
include("file.php");
$query="select * from user where user_name = '".$_POST['user']."';";
$link = mysql_query($query);
$line = mysql_fetch_array($link);
if((isset($_SESSION['pass']))||($line['user_pass'] == sha1($_POST['pass'])))
{ // ---------- HERE IS ONE OPEN
if(!isset($_SESSION['pass']))
{ // --------- HERE IS SECOND OPEN
$_SESSION['user'] = $_POST['user'];
$_SESSION['pass'] = $_POST['pass'];
} // ---------HERE CLOSES ONE
?> // HERE THE SCRIPTS END, WITH UNBALANCED PARENTHESIS
the rest is ignored.. the script is searching for a command
<html>
<head>
..
..
..
Sometimes indenting the source helps a lot
three years late, but the true is revealed 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:14 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|