php – 使用Symfony框架在生产服务器上登录失败(由于…无法处理身份验证请求)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – 使用Symfony框架在生产服务器上登录失败(由于…无法处理身份验证请求),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2851字,纯文字阅读大概需要5分钟。
内容图文
![php – 使用Symfony框架在生产服务器上登录失败(由于…无法处理身份验证请求)](/upload/InfoBanner/zyjiaocheng/698/32aec24e169749e0bd1514c6697dde06.jpg)
我正在使用Symfony进行项目,并且我一直试图让登录在生产服务器上工作,过去2天没有成功.我一直在收到错误
Authentication request could not be processed due to a system problem.
我已按照此处的指南(http://symfony.com/doc/current/cookbook/security/entity_provider.html)设置从数据库加载用户.
我的security.yml文件:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Acceptme\UserBundle\Entity\User: plaintext
role_hierarchy:
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
patricia:
password: patricia
roles: 'ROLE_ADMIN'
users:
name: user_provider
entity: { class: AcceptmeUserBundle:User, property: username }
firewalls:
user_area:
pattern: ^/
anonymous: ~
provider: user_provider
form_login:
login_path: login_route
check_path: _login_check
default_target_path: homepage
dev:
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
security: false
default:
anonymous: ~
http_basic: ~
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
我的SecurityController.php:
namespace AppBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Security\Core\SecurityContext;
class SecurityController extends Controller
{
/**
* @Route("/login", name="login_route")
* @Template("security/login.html.twig")
*/
public function loginAction(Request $request)
{
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
}
return array(
'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error,
);
}
/**
* @Route("/login_check", name="_login_check")
*/
public function securityCheckAction()
{
// this controller will not be executed,
// as the route is handled by the Security system
}
}
我尝试在2个不同的网络主机(FatCow和GoDaddy)上传项目,问题仍然存在.本地我使用PHP 5.4.19(FatCow使用5.3.2,GoDaddy使用5.4.37).请记住,使用XAMPP在localhost上工作时一切正常!
我已经确认在这两种情况下都启用了PDO.我已经确认参数.yml文件中的数据库用户名,密码和主机是正确的.本地和远程服务器上的错误日志都不显示.
我已经遵循了上一篇文章Deploying Symfony2 app getting fosuserbundle errors的所有指示,仍然没有成功.
我提前感谢所有的帮助.
解决方法:
它看起来像是错误:
Authentication request could not be processed due to a system problem.
过于通用,并没有告诉任何问题在哪里(关于此问题有一个问题here).
我通过检查日志解决了我的问题,看看发生了什么(在var / logs / dev.log中),希望这有助于某人.
在我的特定情况下,parameters.yml中有关于数据库连接的错误参数.但是,同样,错误过于通用,并不一定意味着问题与数据库连接有关.
内容总结
以上是互联网集市为您收集整理的php – 使用Symfony框架在生产服务器上登录失败(由于…无法处理身份验证请求)全部内容,希望文章能够帮你解决php – 使用Symfony框架在生产服务器上登录失败(由于…无法处理身份验证请求)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。