Receiving the following error while trying to register a custom Magento2 module on my local machine:
Parse error: syntax error, unexpected ''DDF_AdminMenu''
(T_CONSTANT_ENCAPSED_STRING), expecting ')' in
/Users/petey/Desktop/magento/app/code/DDF/AdminMenu/registration.php
on line 5
I can't seem to understand why I'm getting the error.
My code is the following:
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'DDF_AdminMenu',
__DIR__
);
I know this may seem obvious but it happened to me
Please make sure you add <?php at the beginning of the file
Related
I created a new project: laravel new myprojectname and I am getting a blank page. First, I thought is about the permission so I gave the 777 to the storage folder, but I still had the blank page. Then I checked the logs and I saw this:
production.ERROR: Parse error: syntax error, unexpected '?', expecting
variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug
\\Exception\\FatalThrowableError(code: 0): Parse error: syntax error,
unexpected '?', expecting variable (T_VARIABLE) at /opt/lampp/htdocs
/myprojectname/vendor/symfony/routing/Route.php:53) .....
My php version is: 7.1.14 . Does anyone know why I get this ?
Thank you
The ? at line 53 is the new nullable types introduced in PHP 7.1, and you are running PHP 7.0.9, hence the reason why you're getting the error.
Laravel just upgraded to 5.6 and it requires PHP 7.13.
Also, after you upgrade your PHP, make sure you upgrade PHPUnit ~7.0, fideloper/proxy ~4.0, and Symfony ~4.0.
Follow this link here for full upgrade details.
in my project old developer used # at many places so now i have to upload project on server but at server # does not support i dont why
Porject is developed in codeigniter
Parse error: syntax error, unexpected '#' in
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected '#'
Please guys guide me
Thanks in Advance
Just update PHP version it will sort out
I had a website but is currently gone but I always had a back-up that worked on my hosting always.. I tried setting my website up on XAMPP but I keep getting the error: Parse error: syntax error, unexpected end of file.. I tried closing brackets but it didn't work. Can you guys please help me where the problem is? This is the index.php of my template where I'm getting it(backend of Joomla is doing fine):
http://pastebin.com/CzGbybYZ
Thanks.
My guess? Short tags aren't enabled, meaning the <? } ?> is not recognised as your "end of code block". Use <?php } ?> instead.
In PHP why is this a syntax error:
$row['some_key'] = "kkkk";
Raises
Parse error: syntax error, unexpected T_STRING
From the documentation I understood this to be perfectly valid PHP, yet it throws the same error every time (and the error of course goes away then I comment the line out).
Edit: After long searching I actually noticed that the file is indeed corrupted in some way. In Vim (on ubuntu 12.04) the file looks just normal. But when viewing from other computers it's corrupted. So not related to PHP.
In PHP why is this a syntax error:
It's not. If you're getting unexpected T_STRING, the problem is elsewhere (hint: look at the line above).
I am seeing this error in a file called functions.php:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'
I just installed a new theme in wordpress, I don't know much php.
Is this something I can fix easily?
It means the syntax of the file is invalid for the version of PHP you're running it on. It probably means your version of PHP is outdated, i.e. the theme requires PHP5 and you're running on PHP4.
That, or it's a poorly developed theme that has syntax errors.
As ** Deceze** said this issue comes when your website is running on lower version of PHP. To avoid it you can upgrade to Php5.3+ and It will start working. Also yu may get this error Error Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING. These errors comes because the support for namespaces is not their in php versions < 5.3.