I have copied a Symfony2 project from a computer to another one, but I got this error
FatalErrorException in D:\wamp\www\projet\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\
ClassMetadataFactory.php line 80:
Parse Error: syntax error, unexpected '[', expecting ')'
Check your php versions on both machines or try to run
composer update
on the new one. My guess is that you have an older version of php on the new machine
Related
Did somebody tried Doctrine 2.9.x-dev? I am using with symfony 5.2.6. I know it is a dev version but when run any command I get an error for example:
[critical] Error thrown while running command "'doctrine:schema:create'". Message: "An option named "em" already exists."
and when I run only bin/console i get error
[critical] An error occurred while using the console. Message: "An option named "em" already exists."
An option named "em" already exists.
It is because this is dev version (2.8.4 is working) or am I missing something?
The error comes from doctrine/doctrine-bundle - it seems like it is not compatible with doctrine/orm 2.9.x-dev yet.
The problem is already being worked on, but the PR has not been merged yet, see: https://github.com/doctrine/DoctrineBundle/pull/1327
If you really need the dev version to work with Symfony right now, you will need to apply the changes manually, but I would recommend waiting for a stable release.
I have a functioning local install of api-platform on WSL:
http://127.0.0.1:8000/api/
However, after I ran composer require api-platform/admin-pack, I get the following 500 error at /api:
An exception has been thrown during the rendering of a template ("Asset manifest file "/mnt/c/Users/user/symfony-project-path/public/build/manifest.json" does not exist.").
Last line of stack trace:
in vendor/api-platform/core/src/Bridge/Symfony/Bundle/Resources/views/SwaggerUi/index.html.twig (line 9)
Similarly at /admin, I get the following error:
An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "/mnt/c/Users/user/symfony-project-path/public/build/entrypoints.json" does not exist.").
Last line of stack trace:
in templates/admin.html.twig (line 9)
Was the install script supposed to create the ./build dir in ./public?
Any help would be appreciated. Thanks.
Environment
OS: Ubuntu 18.04 (WSL)
Symfony: v4.4
Try running yarn watch in your project directory.
i install wellCommerce for symfony3 in my server with PHP7 and i'm getting this error:
FatalErrorException in AdminSubscriber.php line 74:
Parse Error: syntax error, unexpected ':', expecting ';' or '{'
The code that produce this error is this one:
private function getUserRepository() : UserRepositoryInterface
{
return $this->get('user.repository');
}
I read about Return Type Declarations on php7 and i don't know why i'm getting this error.
Thank you so much for your help.
I have installed PHP5.6 and PHP7 but apache takes PHP5.6 as default. To fix this issue i remove all PHP in the server and install the last version of PHP7.1.
Environment: Symfony 2.8.1 with XAMPP Version 5.5.24 on Windows 7.
If I trigger a fatal error in a controller, anything as simple as $array = ; in production environment, I'm getting a default php error:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\tgsupport-test\src\AppBundle\Controller\DefaultController.php on line 16
followed by symfony custom error page message. Obviously I'd want to avoid to show eorr info in production.
Moreover in prod.log I see a double critical error: under php.CRITICAL and request.CRITICAL. Is really useful to show the same error twice?
I'm using default configuration, indeed I just installed default framework without any custom setting and I triggered my error in AppBundle/DefaultController, so I was wondering if I'm missing anything.
I missed a php.ini configuration to avoid to display error messages in page.
At the moment I'm experimenting with Nginx.
I got it working using the newest version installed via repo.
Everything works fine with Nginx standalone.
Then I installed PHP 5.5.1 via sources that I can run different versions and not affection the production webserver and php version. (Nginx was running on another port then 80 for testing purposes.)
Everything went fine. Compiled PHP 5.5.1 without errors, installed it, started PHP-FPM and changed the Nginx config to call PHP FPM when needed. My first test website worked perfectly with this version. Then I tried to get running another website I created. I've changed only the document root for that.
Then I got very strange errors:
PHP Fatal error: Call to undefined function apache_request_headers() in [...]
Yes, not real an error... So I removed the function to test if the website works then smoothly when removing a function, which isn't available in PHP-FPM/FastCGI Mode.
Then another error showed in the logs when trying again:
PHP Parse error: syntax error, unexpected ''INSERT ' (T_ENCAPSED_AND_WHITESPACE) in [...]
After commenting out this variable (only for testing) another error occured:
PHP Parse error: syntax error, unexpected end of file, expecting ')' in [...]
So I don't know why those 2 errors occured. The first one is of course of the changed system; function not available.
So my main question is: Why is my code causing these errors with PHP 5.5.1 in FPM mode?
The website works perfectly on my local dev server (PHP 5.4 and Apache) and production Server (Apache 2.2 and PHP 5.4)... I have NO code changed (except config files for db etc). So is someone knowing what can cause this issue?
If you need more information, just ask!
Edit:
Error 1:
$sql = 'INSERT INTO ' . TABLE . '
(name)
VALUES
("' . $name . '")
ON DUPLICATE KEY UPDATE name=VALUES(name)';
Error 2:
'TEXT' => text::parse($row['text']),
Problem solved.
PHP rebuilt via source and used newest version (5.5.2).