General developer forum

Call to undefined function pam_auth

Picture of Adam Morris
Call to undefined function pam_auth

This is more of a sysadmin question. I'd like to use the PAM authentication method and when I turned it on I got this message:

PHP message: PHP Fatal error:  Call to undefined function pam_auth()

I'm using Ubuntu 12 and apt-get install php5-auth-pam reports no installation candidate.

Average of ratings: -
Picture of Brad Smith
Re: Call to undefined function pam_auth

Just in case anyone else runs into this, the solution is in /usr/share/doc/php5-auth-pam/FAQ.gz  (you can view it by running zcat /usr/share/doc/php5-auth-pam/FAQ.gz | less). 

Basically, you have to make it so the web server's user (www-data) can read /etc/shadow. The easiest way to do this is:

  1. Open /etc/group in a text editor (you will need sudo/root privs)
  2. Find the line that begins www-data
  3. Add www-data to the end of that line (after that last colon) 
  4. Restart apache: service apache2 restart
Average of ratings: -