FOS/user-bundle ProxyManager\Configuration error - symfony

After installation of friendsofsymfony/user-bundle I getting this error
FatalThrowableError in Configuration.php line 124:
Type error: Return value of ProxyManager\Configuration::setGeneratorStrategy() must be an instance of ProxyManager\void, none returned
Using Symfony3.2 and PHP 7.1
Maybe have ideas why?
EDIT
I used This tut
https://symfony.com/doc/master/bundles/FOSUserBundle/index.html
And choose "Doctrine ORM User class" for user entity

This is because you are using the incorrect php version.
This might happen either because you updated your php version recently or your OS updated it.
Like #Ɓukasz D. Tulikowski mentioned void is a php7.1 keywork.
If you check in your cli php -v you will get probably the correct php version php7.1
Most likely if you add in your code phpinfo(); you will see that the php version is 7.0. This means that the php7.0 mod is still enabled and you need to deactivate that with sudo a2dismod php7.0 (and eventually enable 7.1 - sudo a2enmod php7.1 - but this is probably not the case.)

This mean maybe you are using php version 7.0, I had the same problem, I fix it removing php previous versions and then reinstall php 7.2 following thishttps://ayesh.me/Ubuntu-PHP-7.2

Related

How to adapt my composer.lock version for a lower php version?

I made a symfony project on php 7.4, however it seems like OVH php version is 7.3.16.
Which folder are not necessary for deployment and how can I adapt my composer for a different php version ?
Here's the error I get while accessing to my website :
Fatal Error: composer.lock was created for PHP version 7.4 or higher but the current PHP version is 7.3.16.
OVH offer a way to change the PHP version used by your domain.
Check Details of the .ovhconfig file for more information about it. You should also have an option in the control panel about it.

Error Installing Silverstripe 4.0.1

Trying a fresh install of Silverstripe 4.0.1 but only gets this far -
Installing SilverStripe...
I am now running through the installation steps (this should take about 30 seconds)
If you receive a fatal error, refresh this page to continue the installation
Setting up /var/www/duonsdev/public_html/index.php
Setting up /var/www/duonsdev/public_html/mysite/_config.php
Setting up /var/www/duonsdev/public_html/mysite/_config/theme.yml
Setting up /var/www/duonsdev/public_html/.env
Setting up /var/www/duonsdev/public_html/.htaccess
Building database schema...
ERROR [Emergency]: Uncaught TypeError: Return value of Symfony\Component\Filesystem\Filesystem::toIterable() must be an instance of Symfony\Component\Filesystem\iterable, array returned IN POST /install.php Line 729 in /var/www/duonsdev/public_html/vendor/symfony/filesystem/Filesystem.php Source ====== 720: } 721: 722
And the error goes on and on. I tried refresh, but same error.
If I try a dev/build instead then it always dies at the point of -
Index File_Versions.OwnerID: created as index ("OwnerID")
Website Error
There has been an error
The website server has not been able to respond to your request
Trying to setup on Ubuntu 16 on local dev machine running Apache virtual host.
Never had this problem before and setup fine with ss4.0.
Any ideas?
I ran into the same issue, and after checking in the official SilverStripe Community's slack channel, they mentioned this is because I was not running PHP 7.1.
Apparently, the official SilverStripe tarball offered in their website was built with PHP 7.1, so Composer added newer Symfony dependencies. They mentioned this would be fixed in newer releases.
Therefore, there are 2 ways you can fix this issue:
Download SilverStripe with Composer:
$ curl -sS https://getcomposer.org/installer | php
$ ./composer.phar create-project silverstripe/installer /var/www/duonsdev/public_html/
Update your PHP version to 7.1.
After doing any of those steps, you will be able to access the web wizard for installing SilverStripe.
NOTE: If you're on a shared hosting, you will need to download SilverStripe on your local machine (ensuring the PHP version matches, at least in the major version, e.g. 7.0), and upload the files that were generated to your public_html directory.
Make sure the module php version of apache in the same version as the cli php version.
Looks like the error was to do with the php version.
I was installing silverstripe through the cli using composer, but running a different version of php in apache.
So in the cli the php version was php 7.1
But in apache the php version was php 7.0.
After changing the apache php to match the cli (because silverstripe was installed using composer in the cli) it worked!

phpDocumentor with PHP 7.1 Return Type Declarations

We are attempting to start using phpDocumentor for a Symfony 3 site running PHP 7.1.
We are using return type declarations on nearly every entity to keep things clean. phpDocumentor does not seem to support this although I see several references to PHP 7 support on their GitHub.
This is the error for every single entity:
Parse Error: Syntax error, unexpected ':', expecting ';' or '{'
I encountered this problem when I migrated from PHP 5 to PHP 7.1 on Ubuntu / Linux, so you need to make sure that you are really using PHP 7.x!
Click on any route name on yourSymfonyprofiler, then click to Configuration(left bottom) and check your PHP Configuration. In my
case 7.1.9-1+ubuntu17.04.1+deb.sury.org+1. Or simply display phpinfo();
If you still using PHP < 7.x that means you need to enable PHP 7.x and disable other versions :
sudo a2enmod php7.1
sudo a2dismod phpx.x
sudo service apache2 restart
Nb: I assume that you are using Ubuntu / Linux.

Symfony Installation gives fatal error

I'm new to the symfony2 and I was following http://symfony.com/doc/current/book/installation.html for installation using Composer now
It gives me a Fatal Error after some time:
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
Writing lock file
Generating autoload files
Fatal error: Call to undefined method Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::defineDirectoryStructure() in /Users/app/SymfonyStandard/RootPackageInstallSubscriber.php on line 28
#hap absolutely right on Debian/Ubuntu
sudo apt-get install php5-curl
is solving this issue. I think on another platform php5-curl will help too.
RESOLVED:
Got the same problem. Deleted the file composer.phar, installed again via curl -s https://getcomposer.org/installer | php - problem persists
/path/to/webroot/project/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/ScriptHandler.php file does not have the method defineDirectoryStructure() in it
symfony/framework-standard-edition (v2.6.1)
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
problem here
sensio/distribution-bundle (v3.0.11)
Thanks #hap, this helped
sudo apt-get install php5-curl
Just had this problem on Debian. For me the problem was that sensio/distribution-bundle in its last version (v3.0.12, the one introducing the defineDirectoryStructure function) requires the cURL PHP extension, which was not installed, so it installed v3.0.11 (which don't contain the required method).
After installing php5-curl, Composer finaly installed the last version of sensio/distribution-bundle and everything was fine.
Got the same problem too ... Works on a debian distrib, but doesn't work on my wamp on windows 7 !
So tried to update my wamp, to get PHP5.5, reconfigure composer to use this PHP, still didn't work ..
Then I tried to launch the Console in Administrator mode, and launch :
"composer create-project symfony/framework-standard-edition sfproject/"
And guess what .... That finally worked !! With administrator rights ... Just give it a try ;)
I have same problem. I just added in composer.json string "symfony/symfony": "2.3.*", And its working for me.
Also, i deleted my composer.phar and composer.lock files.
The problem, if you have in your project symfony 2.3 it installing dependencies for v 2.7 .
I got this error from a install into a new vagrant VM, it would appear that something done recently has broken this as I managed to install a 2.6.0 version last week whilst testing, now it doesn't work.
After a bit of trial and error, it appears that the 2.6x and 2.5x branches are both affected and will not install, but 2.3x and 2.4x do install without the error.
incase anyone doesn't know how to install a specific version, just add it onto the end of the composer command, i.e.
composer create-project symfony/framework-standard-edition . 2.4.x
VM: Ubuntu 14.01 / PHP 5.5.9
I had the same problem in an Ubuntu 14.04 VM set up with PuPHPet and Vagrant/VirtualBox.
I've noticed that when I had the same problem, the DistributionBundle was severely out of date. Trying to upgrade it manually from composer.json (changing the version to 3.0.12, which was the las one available at the time I had the problem) produced a more verbose error, stating I hadn't installed php5-curl.
After updating the PuPHPet config file to include the cURL module for PHP and reprovisioning my VM, Symfony installed just fine, having installed the last version of Sensio Distribution Bundle, which contained the defineDirectoryStructure() method.

how to use apc in symfony2

I'v just install and configured a clean copy of Symfony2 framework and included in php.ini the extension
php_apc_319_php54_vc9_win7-2008.dll
restart apache and run the url "http://localhost/Symfony/web/app_dev.php/"
it was all fine until refreshing the page and getting an error :
Fatal error: Call to undefined method
Symfony\Component\ClassLoader\ApcUniversalClassLoader::registerNamespaces()
in E:\phpWorkspace\www\Symfony\app\autoload.php on line 10.
I'v allready read this chapter about performance
but maybe I didn't use it well
I'm a novice with symfony so I will be very happy to get astep by step tutorial
You need to install Apc in php
Install apc link1
Install apc link2
I would guess from the file you are using (php_apc_319_php54_vc9_win7-2008.dll) that this dll purports to provide APC 3.1.9 for use with PHP 5.4. Support for PHP 5.4 wasn't added to APC until 3.1.10, and even now is only officially in beta.
At time of writing, the latest version is 3.1.13. I would install that before investigating anything else.

Resources