amishmm / php-pam

This extension provides PAM (Pluggable Authentication Modules) integration for PHP
Other
10 stars 5 forks source link

Can't get it working on Ubuntu 22.04.4 with PHP 8.1.2, could you help? #15

Open sensboston opened 2 weeks ago

sensboston commented 2 weeks ago

Hi, I'm trying to get pam working in php (for my project user authentication) but can't. Installed all prerequisites sudo apt-get install php-dev libpam0g-dev php-pear built this module

phpize
./configure
make
sudo make install

added (by ChatGPT advice) changes to php.ini:

extension_dir = "/usr/lib/php/20210902/"
extension=pam.so

restarted apache, but command php -m | grep pam still returns nothing.

Could you please provide me some tips, how to properly install this module?

Thank you!

sensboston commented 2 weeks ago

Update: just tried your PHP test script

<?php
if (extension_loaded('pam')) {
    if (!pam_auth("my_actual_username", 'my_actual_password', $error)) {
        echo "fail: $error\n";
    }
    else {
        echo "pass: $error\n";
    }
}
else {
    echo "pam.so not loaded\n";
}

now I'm getting: fail: Permission denied (in pam_authenticate)

It looks like pam extension is loaded (even it not shown by php -m | grep pam command) but some permission (?) denied. Any suggestions?