Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP sessions instead of Symfony #199

Closed
Aguay-val opened this issue Feb 9, 2017 · 6 comments
Closed

PHP sessions instead of Symfony #199

Aguay-val opened this issue Feb 9, 2017 · 6 comments

Comments

@Aguay-val
Copy link

HI,

I'm using Agendav with php server side session management instead of using Symfony session management.

But after upgrade from beta to stable i couldn't do it anymore.

I have this :

[2017-02-09 12:45:43] agendav.CRITICAL: RuntimeException: Failed to start the session: already started by PHP. (uncaught exception) at /var/www/agendav/web/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 131 {"exception":"[object] (RuntimeException(code: 0): Failed to start the session: already started by PHP. at /var/www/agendav/web/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:131)"} []

How can i use php sessions again ?

@jorgelzpz
Copy link
Collaborator

Just curious: are you using session auto-start?

I am thinking about providing a way to override some AgenDAV services from the settings file.

As a quick and dirty fix, you could edit web/app/services.php and return a NativeSessionHandler instead the current PdoSessionHandler.

@Aguay-val
Copy link
Author

Just curious: are you using session auto-start?

I don't really know !

First of all, i successfully launch agendav without the error message :

Failed to start the session: already started by PHP. (uncaught exception)

What did i do ?

I realize i just done dirty fix by commenting the line :

if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) {
            #throw new \RuntimeException('Failed to start the session: already started by PHP.');
        }

into the file vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php. Yes that's really bad.

As a quick and dirty fix, you could edit web/app/services.php and return a NativeSessionHandler instead the current PdoSessionHandler.

I tried to do your quick fix without success.

If you want any other informations, just ask me :)

Thanks for your help !

@jorgelzpz
Copy link
Collaborator

@Aguay-val AgenDAV 2.1.0 allows you to modify already defined services. Try adding the following line to your settings.php file:

$app['session.storage.handler'] = null;

@Aguay-val
Copy link
Author

Aguay-val commented Mar 22, 2017

I still have a problem.

Here the log. I was not able to upgrade due to this error :

agendav.CRITICAL: RuntimeException: Failed to start the session: already started by PHP. (uncaught exception) at /var/www/agendav-2.1.0/web/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 131 {"exception":"[object] (RuntimeException(code: 0): Failed to start the session: already started by PHP. at /var/www/agendav-2.1.0/web/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:131)"} []

Fresh install of agendav 2.1.0.

This happen when i have davical server installed and running on the same server.

@Aguay-val
Copy link
Author

Hey here i am again. I finally found what's wrong with my setup.

I wanted PHP to be used to store sessions as a file in "/ var / lib / php5 / session".

So i use the, into the /etc/apache2/php.ini:
Session.auto_start = 1

The agendav's PHP sessions with this config key, was not able to be created.

I try to disable this setting and finally it works. Unfortunatelly i have no more "sessions files" into the directory.

Do you think it would be possible for Agendav to work with this setting in the php.ini?

@jorgelzpz
Copy link
Collaborator

Perhaps disabling session.auto_start from your webserver is the cleanest way to make it work. The alternative is modifying AgenDAV's index.php by adding a ini_set() before the application starts.

Have a look at How to change configuration settings, if you use Apache you can place PHP directives inside a <Location>/<VirtualHost> to disable autostarting sessions just for AgenDAV.

I'm closing this issue as it is actually a configuration issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants