Re: File::Password::ChangePasswd() Question
| From: | Michael Wallner | Date: | Tue, 20 Jan 2004 15:00:45 +0000 |
| Subject: | Re: File::Password::ChangePasswd() Question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10246@lists.php.net to get a copy of this message | ||
Hi Gilles lévesque, you wrote:
> I run Solaris 9 on a sparc With Apache 1.3.29, PHP 4.3.4
>
> I've installed File_Passwd
> and I get this error message :
> Fatal error: Call to a member function on a non-object in
> /usr/local/lib/php/File/Passwd/Unix.php on line 540
>
> Nothing seems to work...Anyone can help me?
You cannot call this method statically,
Line 540 in recent File_Passwd_Unix is:
if (!$this->userExists($user))
Have a look at this example:
<?php
require_once 'File/Passwd.php';
PEAR::setErrorHandling(PEAR_ERROR_PRINT);
$pw = &File_Passwd::factory('Unix');
$pw->setFile('/etc/passwd');
$pw->setMode(FILE_PASSWD_DES); // or FILE_PASSWD_MD5
$pw->load();
$pw->changePasswd('mike', 'secret');
$pw->save();
?>
Be aware that File_Passwd_Unix is *NOT* functional
with _shadowed_ passwd files.
Regards & HTH,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]