Parse Error Syntax Error Unexpected T_string Expecting T_function In Cakephp
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about syntax error unexpected t_string expecting function t_function hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask syntax error, unexpected 'define' (t_string) Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join
Parse Error Syntax Error Unexpected ' ' In Php
them; it only takes a minute: Sign up PHP Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION up vote 1 down vote favorite I get this error in my PHP code: PHP Parse error: syntax error, unexpected T_STRING, expecting
Php Define
T_FUNCTION in C:\Inetpub\wwwroot\webroot\www.novotempo.org.br\lib\Twitter.php on line 54 The line in question: define('DEBUG',false); Searching the net I found that this usually occurs when you´re using PHP 4.xx, but I´m using 5.2.6 (Just checked it using phpinfo()). I tried locally, and in two other external hosts, but it keeps returning the same message. Why does this happen? How can I fix it? php parsing share|improve this question edited Jan 28 at 14:01 legoscia 24.4k94982 asked Aug 17 '09 at 16:03 Douglas Santos Pinto The true problem is probably one one of the lines before it –Greg Aug 17 '09 at 16:05 Can you post more of the code (a few lines above and a few beneath)? –Mike Dinescu Aug 17 '09 at 16:06 Inside a class method, I got this error when I commented an if statement but forgot to comment the closing brace. That put my next line outside of the function definition. It was a call to a static class function, which PHP saw as an unexpected string literal, I suppose. –Buttle Butkus Jan 10 '14 at 1:22 add a comment| 2 Answers 2 active oldest votes up vote 11 down vote If you are trying to DEFINE something inside of a class but outside of a function, you are going to get this error. (Normally the only place PHP will be looking for a function and not expecting a string is in a class, outside of a method) IE: Your code should not look like this: class myClass { define("DEBUG", true); function myFunc() { } } share|improve this answer edited Aug 17 '09 at 16:18 answered Aug 17 '09 at 16:08 Tyler Carter 39.8k1895131 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). Subscribed! Success
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up CakePHP: syntax error, unexpected T_LIST, expecting T_STRING up vote 2 down vote favorite my cakephp app throws me http://stackoverflow.com/questions/1288837/php-parse-error-syntax-error-unexpected-t-string-expecting-t-function that error,on that line: class List extends AppModel { and i cannot understand why. the whole List.php model file is: data[$this->alias]['password'])) { $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']); } return true; } ?> Does anybody has an idea why this is happening? thank you! cakephp syntax-error share|improve this question asked May 10 '13 at 20:54 Kostas Livieratos 181724 add a http://stackoverflow.com/questions/16490692/cakephp-syntax-error-unexpected-t-list-expecting-t-string comment| 1 Answer 1 active oldest votes up vote 12 down vote accepted List is a reserved keyword in PHP You're getting this error, because list is a reserved keyword in PHP and therefore cannot be used as the name of your class; http://php.net/manual/en/reserved.keywords.php Rename your model to something else and you should be fine. To still use the same database-table, manually specify the database-table that the model uses via the useTable property; class MyList extends AppModel { public $useTable = 'lists'; } share|improve this answer answered May 10 '13 at 21:03 thaJeztah 11.2k41845 OK thank you :) –Kostas Livieratos May 10 '13 at 21:06 It's easily overlooked :) Glad I could help –thaJeztah May 10 '13 at 21:07 @koslib could you mark this question as "answered" by accepting this answer? –thaJeztah Jan 19 at 6:37 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged cakephp syntax-error or ask your own
CRM installation and got the following parse error when installing onto my MediaTemple http://wiltonsoftware.com/posts/view/cakephp-parse-error-syntax-error-unexpected-t_string hosting :- Show Plain TextPHP codeParse error: syntax error, unexpected T_STRING, https://www.daniweb.com/programming/web-development/threads/371048/how-to-fix-parse-error-syntax-error-unexpected-t-string-expecting-t-variable-or expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR This error relates to the PHP 4.X version not understanding the function declarations public, private and protected. What I had forgotten was the default fresh install under MediaTemple is PHP 4 for a new domain, don't syntax error ask me why but it is. The simple solution is to put the following in the ../html/.htaccess file :- Show Plain TextText codeAddHandler php5-script .php Filed under: Cakephp, HostingTags: Mediatemple, Croogo 0 Responses to "Cakephp - Parse error: syntax error, unexpected T_STRING" Sorry, comments have been closed for this post. Categories Apple syntax error unexpected (1)Bookmarks (3)Cakephp (18)Code Snip (7)Cordova (1)Design (6)Embarcadero (11)Hosting (2)Ionic (1)Java (3)Javascript (1)Linux (17)Notes (9)Silverstripe (2)Windows (7) Tags Ajax (1)Applet (3)Bcb6 (2)Bds2006 (2)Borland (7)C (9)Cpp (16)Croogo (1)Css (3)Debian (16)Delphi (12)Embarcadero (15)Error (2)Form (1)Gimp (1)Habtm (1)Hardware (3)Html (1)Ifort (1)Ionic (1)Ios (2)Jquery (1)Mediatemple (2)Mysql (3)Network (1)Os X (1)Pagination (1)Python (2)Rad Studio (3)Radstudio (2)Redhat (3)Rss (1)Seo (4)Setflash (1)Shell (1)Sitemap (1)Ss (2)Ubuntu (15)Update2 (2)Validation (1)Win7 (2)Xcode (1)Xe (2)Xe2 (4)Xe5 (2)Xe6 (1)Xe7 (1)Xe8 (8)Xp (4) Blog feed Site Sections Home Blog Labs Games About Contact Sitemap Blog Categories Apple (1)Bookmarks (3)Cakephp (18)Code Snip (7)Cordova (1)Design (6)Embarcadero (11)Hosting (2)Ionic (1)Java (3)Javascript (1)Linux (17)Notes (9)Silverstripe (2)Windows (7) Latest env: node\r: No such file or directory Error: Hook failed error code 127 osx Move your Microsoft OS Window with the keyboard How to Enable a temporary administrator account in SilverStripe CMS How to Enable a temporary administrator account in SilverStripe CMS How to turn off your RadStudio IDE start page banner display How to turn off
or '$ 0 5 Years Ago Hi, I dont know, what mistake i made in my code. [B]test1.php[/B] [B]test2.php[/B] B(); ?> http://localhost/test2.php Error: Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in C:\xampp\htdocs\MyNameSpace\test2.php on line 3 php jacksantho -3 169 posts since Feb 2011 Community Member 6Contributors 9Replies 22Views 5 YearsDiscussion Span 4 Years Ago Last Post by gilgil2 0 pritaeas 1,895 5 Years Ago Probably you do not have PHP version 5.3 or higher. 0 Discussion Starter jacksantho -3 5 Years Ago I am using "PHP Version 5.3.5". 0 pritaeas 1,895 5 Years Ago Apparantly, you need to use backslashes, see the manual. 0 MikeyB1987 4 Years Ago Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/numyspace.co.uk/web_users/home/~unn_v026713/public_html/updatebook.php on line 29 The browser keeps coming up with this error in my code but i see anything wrong with it :-( Ive tried everything and nothing has changed....Arghhhhhhhhhhhhhhhhhhhh!!!!!!!!! .....Please Help!!! Heres my code! I have put stars next to line 29 code!