Parse Error Syntax Error Unexpected T_class Expecting T_string In
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 parse error syntax error unexpected t_class expecting t_string or t_variable or '$' in laravel this site About Us Learn more about Stack Overflow the company Business Learn
Unexpected 'class' (t_class) Laravel
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question symfony parse error: syntax error, unexpected 'class' (t_class), expecting identifier (t_string) 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 Laravel syntax error, unexpected 'class' (t_class) laravel parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE up vote 9 down vote favorite 3 After installing laravel we get an error: Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in C:\xampp\htdocs\laravel\public\index.php on line 50 laravel-5 share|improve this question edited Aug 25 '15 at 14:26 Gigi 896 asked Aug 25 '15 at 13:39 rajkishor saw 49112
Parse Error Syntax Error Unexpected 'class' (t_class) Laravel
Your PHP version? –idmean Aug 25 '15 at 13:43 add a comment| 2 Answers 2 active oldest votes up vote 21 down vote Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you're seeing is caused by this line $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update your PHP binary. In case you are interested in why ::class is used, take a look at this answer share|improve this answer answered Aug 25 '15 at 13:58 lukasgeiter 52.9k786107 I am using php 5.6.0, but still i am getting Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wamp\www\laravelmaster\public\index.php on line 50 , i checked from cmd like php -v and using laravel 5.2 –151291 May 30 at 9:52 3 @151291 Your CLI version of php (the one you get with php -v) might be different from the one the webserver uses. Put phpinfo() in a PHP
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 $kernel = $app->make(illuminate\contracts\http\kernel::class); About Us Learn more about Stack Overflow the company Business Learn more about laravel 5 requirements hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Laravel 5.2 Php Version
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 unexpected 'class' (T_CLASS) only http://stackoverflow.com/questions/32205590/laravel-parse-error-syntax-error-unexpected-t-class-expecting-t-string-or-t-v on remote (not in local) [duplicate] up vote 5 down vote favorite 1 This question already has an answer here: PHP Parse/Syntax Errors; and How to solve them? 10 answers We are developping a CRM. In local, I have no problem, but in remote (OVH), I have this error message : Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' http://stackoverflow.com/questions/29862558/unexpected-class-t-class-only-on-remote-not-in-local or '$' in /home/dubinfo/www/CRM/model/Locataire.php on line 126 This is the code : public function setVisites($visites) { $this->_visites = CheckTyper::isArrayOfModel($visites, VisiteMaisonInvestisseur::class, 'visites', __CLASS__); } The version of PHP on remote host (OVH) is 5.4.38 php oop share|improve this question asked Apr 25 '15 at 7:54 user3553866 131110 marked as duplicate by John Condephp Users with the php badge can single-handedly close php questions as duplicates and reopen them as needed. Apr 25 '15 at 15:27 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. class is a reserved word. You shouldn't uses it as a property name. –Barmar Apr 25 '15 at 8:04 add a comment| 2 Answers 2 active oldest votes up vote 5 down vote accepted Using class as a name of a constant is available in PHP 5.5 only. To get the class name you can replace VisiteMaisonInvestisseur::class with get_class(new VisiteMaisonInvestisseur). Or change the name of the constant. For example: VisiteMaisonInvestisseur::class_name. share|improve this answer answered Apr 25 '15 at 8:38 Amir 22816 thank you, I changed the php version on the
Apparel forum Discussions forum Forum record_voice_over Laracasts Podcast forum Laravel Podcast Forum Servers Put my Laravel site online lars64 — 1 year ago I already did that but https://laracasts.com/discuss/channels/servers/put-my-laravel-site-online?page=2 still not working. I already did that but still not working. https://laracasts.com/discuss/channels/general-discussion/laravel-installation-getting-parse-error-syntax-error-unexpected-class-t-class-with-php-5611-or-5527 Cancel Update Your Reply lars64 — 1 year ago I really don't understand it anymore. I've two domains and put exactly the same on it. One works the other one doesn't. This is the domain: http://www.leaseregistratie.nl. I've made sure that public is the main root. I didn't syntax error edit the index.php at all. And my host gives me the error: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/lnpo1q/public_html/public/index.php on line 50. I work with control panel and have made the rood directory public_html/public with addon domains. I really don't understand it anymore. I've two domains and unexpected 'class' (t_class) put exactly the same on it. One works the other one doesn't. This is the domain: http://www.leaseregistratie.nl. I've made sure that public is the main root. I didn't edit the index.php at all. And my host gives me the error: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/lnpo1q/public_html/public/index.php on line 50. I work with control panel and have made the rood directory public_html/public with addon domains. Cancel Update Your Reply TheNephilim — 1 year ago What PHP version is your host running? What PHP version is your host running? Cancel Update Your Reply lars64 — 1 year ago @bhulsman PHP-version 5.4.43 @bhulsman PHP-version 5.4.43 Cancel Update Your Reply check taijuten — 1 year ago Please check http://laravel.com/docs/5.1/installation#installation You need PHP 5.5.9 Please check http://laravel.com/docs/5.1/installation#installation You need PHP 5.5.9 Cancel Update Your Reply lars64 — 1 year ago @taijuten thanks for that! I assumed that both domains had the php same version. But obviously not,.... @taijuten thanks for that! I assumed that both domains ha
Apparel forum Discussions forum Forum record_voice_over Laracasts Podcast forum Laravel Podcast Forum General Laravel installation, getting "Parse error: syntax error, unexpected 'class' (T_CLASS)..." with PHP 5.6.11 or 5.5.27 Laravel installation, getting "Parse error: syntax error, unexpected 'class' (T_CLASS)..." with PHP 5.6.11 or 5.5.27 ivanhalen card_membership — 1 year ago Hello, I read around some similar topics about this error: Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wamp\www\laravel5\artisan on line 31 Script php artisan clear-compiled handling the post-install-cmd event returned with an error [RuntimeException] Error Output: run-script [--dev] [--no-dev] [-l|--list] [script] [args1] ... [argsN] But in my case I have latest PHP stable version (5.6.11) and all the requirements are fulfilled (OpenSSL PHP Extension, PDO PHP Extension, Mbstring PHP Extension, Tokenizer PHP Extension - built-in) Please, any help? Thank you Best Answer — Thread Owner's Choice school phildawson — 1 year ago @ivanhalen What does php -v give you on cli? Forgetting Laravel for the moment, if you make a script and put the following in it