I am working on a login for a PHP-based website where users should be successfully logged in if they enter a valid username and password for a local account on the system. Looking around, it seems like the traditional way of doing this was by using the PHP PAM module.
Unfortunately, it looks like this module is now deprecated and I am no longer able to install it with apt-get install php5-pam-auth in Ubuntu Server 14.04. I was able to forcefully install it with pecl install pam, but even then it still doesn't work because using it requires a call-time pass by reference like this:
if ( pam_auth( $uname, $pswd, &$error ) ) {
echo "You are authenticated!"
}
...which results in PHP complaining that call-time pass by reference is also deprecated:
[Fri Jul 24 01:25:35.788680 2015] [:error] [pid 25328] [client xx.xxx.xx.xx:1179] PHP Fatal error: Call-time pass-by-reference has been removed in /var/www/academies/phptest/login.php on line 7, referer: http://<domain>:81/phptest/
Is there an updated or alternative way to do this? I did find this answer to a similar question but I couldn't get the C code to compile; it gave me the following error:
pam.c: In function ‘authenticate’:
pam.c:63:9: error: expected declaration or statement at end of input
return ( retval == PAM_SUCCESS ? 0:1 );
^
According to phpinfo(), I am running PHP version 5.5.9-1ubuntu4.11.