Skip to content

Authentication doesn't work #1

Open
@kentr

Description

@kentr

I can't consistently log in when running Drupal under php-pm. I suspect this is somewhat due to it running under the cli SAPI, based on stepping through a request process and observing behavior around lines such as this in \Drupal\Core\StackMiddleware\Session::handle():

    if ($type === self::MASTER_REQUEST && PHP_SAPI !== 'cli') {
      $session = $this->container->get($this->sessionServiceName);
      $session->start();
      $request->setSession($session);
    }

Given that there are several other cases of guards for PHP_SAPI !== 'cli' in core, it's probably a broader problem.

Activity

kentr

kentr commented on Nov 21, 2015

@kentr
CollaboratorAuthor

Experimentation with running cli scripts through php-fpm look promising.

In basic tests, PHP_SAPI == 'fpm-fcgi'.

References:

kentr

kentr commented on Jan 14, 2016

@kentr
CollaboratorAuthor

While authentication still isn't working, running PHP-PM under PHP-FPM does allow the request to pass the PHP_SAPI guard as expected in \Drupal\Core\StackMiddleware\Session::handle().

I'll post notes about this setup when I get a chance.

kentr

kentr commented on Jan 15, 2016

@kentr
CollaboratorAuthor

Upon further inspection, I think the authentication and other form submission issues are more likely due to the apparent lack of support for cookies and POST data in \PHPPM\Bridges\HttpKernel::mapRequest().

I've made a pull request for the cookies and am experimenting with POST data.

kentr

kentr commented on Jan 15, 2016

@kentr
CollaboratorAuthor

I take it back. POST is supported:

        // parse body?
        if (isset($headers['Content-Type']) && (0 === strpos($headers['Content-Type'], 'application/x-www-form-urlencoded'))
            && in_array(strtoupper($method), array('POST', 'PUT', 'DELETE', 'PATCH'))
        ) {
            parse_str($content, $post);
        }
kentr

kentr commented on Feb 16, 2016

@kentr
CollaboratorAuthor

Cookie support was added.

Running this app under PHP-FPM does appear to solve the problem with PHP_SAPI. There are still problems with authentication ( #4, #6 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kentr

        Issue actions

          Authentication doesn't work · Issue #1 · php-pm/php-pm-drupal