I use the Symfony http foundation stand alone (aka i installed the http-foundation package with composer inside my non-symfony project). Ik would like to change the name of the session cookie. What would be my best way to achieve this?
I read a lot of items regarding this issue, most of them are about configuring the cookie name in the Symfony config.yml settings file which i do not have (stand-alone usage).
Any tips?
You can use Session::setName() instead of session_name()
See this https://symfony.com/doc/current/components/http_foundation/sessions.html#session-workflow
Related
I want to set the hash_function of PHP Native file sessions, so that the session ID has more entropy in Symfony 3 framework, but the configuration options of session does not allow that. I managed to do it by changing the Dependency Injector options and allowed directives in the framework, but I want to do it by configuration, not by hard-coding it and losing it after update.
Do you have any alternatives for that, apart from extending and altering existing Symfony framework component? Am I missing anything?
Thanks in advance!
May be something like this may help:
ini_set( 'session.hash_function', "sha256" );
You can read more about ini_set at Documentation
I am trying to a write a multi-module application in ZF2 but i am facing some weird problem of session.
Session are getting destroyed automatically when i am switching the modules in browser.
Is there any way to share single session accros all the modules.
Thanks
Do you use ZF2 session Manager?
if yes, you probably configure your session in a single module and the other can't find the config
I have downloaded the Braintree for PHP and copied all the content to the directory vendor/braintree (created by me), but I do not know how to declare its classes for being available to the whole project.
The configuration code is very simple. Could I put it together with the declaration code too?
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('myMerchandId');
Braintree_Configuration::publicKey('myPublicKey');
Braintree_Configuration::privateKey('myPrivateKey');
Can someone give a suggestion?
You can, but probably shouldn't. The best way to handle that stuff is to wrap it in a Yii Component and then configure the component with API keys, etc.
Doing so makes it far easier to keep your API keys out of your repo, which is good practice (especially for payment systems :-)
I'm trying to implement the whole page cache in my website. (Just like stackoverflow). I have already implemented the Output Cache, but my friend told me that stackoverflow uses redis as their cache layer and I'm confused about the redis part.
Is redis the same as outputcache? Can I implement outputcache by using redis? (For yii developers, I'm using Yii's outputcache).
Thanks!
Yii's output cache will store the cached content using the active cache component, which can be CDummyCache/CDbCache/CApcCache/CFileCache/CMemCache, etc(what you set in the config file under the components area).
As it stands right now, there is no official CRedisCache component, but there is this extension: http://www.yiiframework.com/extension/rediscache/ which might help you.
Also, since Redis is key/value store and a bit more(though you won't use that bit more at all i guess) you can give CMemCache a try(having in mind you have memcache php extension and memcached daemon installed on your server).
L.E: i also found this for you: https://github.com/phpnode/YiiRedis which seems very neat.
I'm using Symfony components in my web application. I need to store session in APC but unfortunatelly I can't find the way to do it.
As I see here Symfony does not support APC as a session handler. Is that true?
I have found an old example of using APC as a session handler in Symfony. But there all configuration is done in factories.yml file which I don't have since I'm only using standalone Symfony components.
Can anyone give me an example of using APC as a session handler using only Symfony components?
Since I don't get any answer here for a long time I will answer the question myself. For now there is no built in suport for APC as a session handler in Symphony framework. There is no particlar reason for it, likely Symphony developers just did not get to it.
The solution is simple, just code APCSessionHandler.php file yourself (I was not doing it because we decided not use this in project), APCSessionHandler will be very similar to MemcachedSessionHandler.php file.
How to store PHP sessions in APC Cache? suggests it is feasible but a bad idea for a busy site. The accepted answer lists a few useful ideas