Show your code. Also PAM extension is working for you? You can install it also via apt:
sudo apt-get install php5-auth-pam
then try:
pam_auth('username','password',&$error);
echo $error;
pam_auth()
will return boolean true on login, otherwise you can display the errors by echoing the third argument &$error
.