Symfony 2.3.* authentication - symfony

After testing clean install of Symfony 2.3 inside vagrant with Ubuntu 12.04.4 and 14.04 like this:
composer create-project symfony/framework-standard-edition login_not_working 2.3.*
update vendors:
composer install
edit app_dev.php like this, on first line after <?php for permissions:
umask(0000); // This will let the permissions be 0777
go to:
http://vagrant.dev/app_dev.php/
i click nice green button with RUN THE DEMO text and try to login with user/userpass or admin/adminpass. Symfony redirects me to:
http://vagrant.dev/app_dev.php/
and in the profiler i see very impressive message You are not authenticated. and with the extremly impressive red button too :D
This is just for testing and in actual application happens the same thing but on different setup... there i am using SonataUserBundle that extends FOSUserBundle...but it behaves the same...
I cleared cookies over, at least, 3 different browsers, clean cache with console and manually,...yada yada...
It smells like something with my vagrant box setup with/or/and a little flavor of permissions or maybe even sessions or ... boy is this kinky or what?
EDIT:
So, i uploaded both apps (clean test and my actual app with SonataUserBundle) to my VPS and both are workin' fine. Still, on few of my vagrant boxes authentication is not working?
And app/check.php output:
$ php app/check.php
OK PHP version must be at least 5.3.3 (5.5.12-2+deb.sury.org~precise+1 installed)
OK PHP version must not be 5.3.16 as Symfony wont work properly with it
OK Vendor libraries must be installed
OK app/cache/ directory must be writable
OK app/logs/ directory must be writable
OK date.timezone setting must be set
OK Configured default timezone "Europe/Berlin" must be supported by your installation of PHP
OK json_encode() must be available
OK session_start() must be available
OK ctype_alpha() must be available
OK token_get_all() must be available
OK simplexml_import_dom() must be available
OK detect_unicode must be disabled in php.ini
OK xdebug.show_exception_trace must be disabled in php.ini
OK xdebug.scream must be disabled in php.ini
OK PCRE extension must be available
** Optional recommendations **
OK xdebug.max_nesting_level should be above 100 in php.ini
OK Requirements file should be up-to-date
OK You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions
OK When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156
OK You should not use PHP 5.4.0 due to the PHP bug #61453
OK When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)
OK You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909
OK PCRE extension should be at least version 8.0 (8.12 installed)
OK PHP-XML module should be installed
OK mb_strlen() should be available
OK iconv() should be available
OK utf8_decode() should be available
OK posix_isatty() should be available
OK intl extension should be available
OK intl extension should be correctly configured
OK intl ICU version should be at least 4+
OK a PHP accelerator should be installed
OK short_open_tag should be disabled in php.ini
OK magic_quotes_gpc should be disabled in php.ini
OK register_globals should be disabled in php.ini
OK session.auto_start should be disabled in php.ini
OK PDO should be installed
OK PDO should have some drivers installed (currently available: mysql, sqlite)

So, anyway, to answer my own question (kind of) and for the audience...thank you i'm fine... ;)
I configured Symfony to store sessions in memcached and that seems to resolve the problem (kind of). I'll test this on another machine/vagrant to confirm this :D
This "(kinf of)" is whole another story, but i'll leave that for another time :D
EDIT
I tested this on 2 more vagrant boxes and storing sessions to memcached resolve it :)

Related

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!

FOS/user-bundle ProxyManager\Configuration error

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

Composer take too long tu update/install Symfony project (on Windows 10)

Why is 'composer update' running so slow when updating a Symfony project on Windows? If I run diagnose everything looks fine, but the update command takes like 25 min or something. Anyone knows whats is going on?
$ composer diagnose
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK
And here are my php module:
$ php -m
[PHP Modules]
apc
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
As you can see Xdebug is not ON. Anyone knows what cause composer to run so slow (while Internet speed is decent)? Are virtual machines (i.e. VirtualBox) with Ubuntu on it + Putty the only solution to this issue?
Ps. Symfony 2.4.10 is not supported by Symfony installer.
Composer is stoping at:
> post-update-cmd: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
A thing to improve the version resolve speed is by narrowing down the version constraints yourself. In general, I recommend applications to use pretty narrow version constraints (while packages should use the widest version constraints supported). This especially applies to the symfony/symfony version, as there are many versions.
For instance, assume your composer.json file contains something like this: ~2.3. This will simply resolve to the latest version in the 2.x series, which is 2.8. So you can bypass 100 versions (all 2.3-2.7 releases) by setting your version constraint to ~2.8. The result will be the same.
try
composer config --global repo.packagist composer https://packagist.org

Symfony2 and HHVM Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible

i am trying to set up a symfony2 project on a HHVM machine,
The HHVM is running on FastCGI as explained in the hhvm tutorial, thus running behind an apache2 server on Debian.
I have created everything but when i try to run my application i am getting the following error:
ContextErrorException: 16777217: Declaration of Doctrine\DBAL\Driver\PDOConnection::prepare() must be compatible with that of Doctrine\DBAL\Driver\Connection::prepare() in /LOCATION/shared/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 30
I am thinking this has something to do with PDO in HHVM but i tested it using the class_exists('PDO') and that says that PDO is enabled
This is an issue that was fixed via a pull request to the master branch of doctrine/dbal about 2 months ago. However, depending on the branch of Symfony 2 you are using, that doctrine/dbal fix may not be included.
https://github.com/doctrine/dbal/pull/373
If it is possible to use a version of Symfony 2 that includes this latest doctrine/dbal fix, I think you will see that issue go away.
I've had the same issue and upgrading doctrine/orm and doctrine/dbal to latest versions (listed below) fixed my problems.
doctrine/orm : 2.5.#dev
doctrine/dbal: 2.5.#dev
To safely upgrade, open your composer.json file, find and change the versions like so:
composer.json
"require": {
// ... other package requirements
"doctrine/orm": "~2.5.*#dev",
"doctrine/dbal: "~2.5.*#dev",
// .. more packages
Then run composer update doctrine/* which will remove the old versions of doctrine and update all doctrine packages.
The declaration of
Doctrine\DBAL\Driver\PDOConnection::query()
must be compatible with
PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs)
I had the same problem, but the solution was to just change the PHP version from version 8 to 7.3.
Login to your Cpanel with your credentials, search for MultiPHP Manager.
Select the domain or subdomain that you would like to change the PHP version of.
Select from the dropdown menu and chose the appropriate PHP version. (For me, 7.3 worked like a charm.)
Everything worked like it supposed to.

Symfony PDOException could not find driver

I have a problem with symfony2.3, today I have this error message : "PDoException could not find driver" while yesterday everything worked perfectly.
When I run this command line : php app/check.php All is ok :
OK PDO should be installed
OK PDO should have some drivers installed (currently available: sqlite)
In my file parameters.yml all is correctly.
I do not understand why it worked yesterday and today I have this error.
Best regards,
First of all, verify your php.ini file: the extensions (php_pdo_pgsql or php_pdo_mysql) and php_pdo must be enabled. Make sure you apply this changes on php.ini file that your symfony project is using, check this on localhost/path_to_your_project/web/config.php. You know if this extensions are enabled executing the function phpinfo().
This command is also helpfull: php -m. It lists on console all the php modules that are loaded.
Tip: check out you Apache error log, there could be something wrong with the load of your extensions. This file is located according to your server configuration.

Resources