Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 7th, 2006, 06:28 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP Parse error: parse error, unexpected T_STRING

I went through the SimpleMail() example in the Wrox PHP5, Apache, MySQL Web Development book and am having a problem. I successfully implemented this on one site but copied the class over to a different one and it won't work. I am getting the following error:

PHP Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'

Others have asked about this exact error but the only response I've seen is that maybe there is a typo in the code. If this didn't work on a different site, I would think that is a fair comment but since it works elsewhere, that isn't it.

I'd appreciate any help.

Thanks,

Pat
 
Old May 7th, 2006, 07:05 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found some information that says PHP5 needs to be running and it turns out that PHP Version 4.3.11 is running on the server. I hope this information helps anybody with experiencing the same problem.
 
Old May 14th, 2006, 05:11 AM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmm... this is my guess here.. dont take it too seriously..

as you are using php 4.3.11, i would likw you to upgrade your PHP to the latest version and an upto date build.

and in your code just remove the public/private declared functions to simple functions and public variables to simple variable (var).
ie., 'public function lock()' must be changed to 'function lock()' and 'public $amount;' to 'var $amount;'

and dont forget to recheck the set of paranthesis at the end of the code or somewhere in the middle..

I am Still Learning ! please Co-operate With Me :)
 
Old May 17th, 2006, 05:37 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Downgrading to PHP 4 and removing PHP 5 syntax isn't going to help.

It's a syntax error, you have something fundamental that is malformed, one too many curly braces "{" or "}" or not enough curly braces, or something else that is out of place.. e.g. some character or bits that PHP doesn't understand. Look for something out of place.

Regards,
Rich

--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results

http://www.catb.org/~esr/faqs/smart-questions.html
 
Old August 18th, 2007, 02:27 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry Richard, but this is a typical message about php5 code running on a php 4 server.

So the possibilities are downgrading code, or upgrading server if possible...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
Parse error: parse error, unexpected $end Ayodeji Adegbaju Pro PHP 3 January 12th, 2007 12:21 PM
Parse Error unexpected T_IF Adam H-W Beginning PHP 2 June 9th, 2006 03:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.