dongxu7408 2018-03-06 08:29
浏览 82

PHP7与pam_auth()未定义的函数

I am working on a Login-Formular for Linux servers based on PHP. The requirements are that every user is only able to login with his Unix account. I've read about the PAM-Module, but I can't get it running.

Using lighttpd as webserver on a ubuntu16.04. The error log provides me:

2018-03-06 09:17:19: (mod_fastcgi.c.2695) FastCGI-stderr: PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function pam_auth() in /var/www/html/example2/login.php:36
2018-03-06 09:17:19: (mod_fastcgi.c.2695) FastCGI-stderr: Stack trace:
2018-03-06 09:17:19: (mod_fastcgi.c.2695) FastCGI-stderr: #0 {main}
2018-03-06 09:17:19: (mod_fastcgi.c.2695) FastCGI-stderr:   thrown in /xxx/xxx/xxx/xxxx/login.php on line 36

login.php minimal view

<?php
    if(isset($_POST['submit'])) {
        $username = $_POST['username']; $password = $_POST['password'];
        if(pam_auth($username, $password)) {
            $_SESSION['login'] = true; header('LOCATION:overview.php'); die();
        } else {
            $errorMsg = "Username or Password is incorrect.";
        }
    }
?>

I added into /etc/php/7.0/fpm/php.ini:

pam.servicename = "php";

and created: /etc/pam.d/php

auth    sufficient  /lib/security/pam_pwdb.so shadow nodelay
account sufficient  /lib/security/pam_pwdb.so

Do I need to include something into my login.php? Or what else am I missing here? I'm not allowed to use other systems like LDAP, DB's etc

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 再不同版本的系统上,TCP传输速度不一致
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程