Hi,
I'm running a Debian jessie/sid web server and I want to configure a directory in order to use the same user accounts for different services. I installed and configured slapd and phpldapadmin. For the latter I had to create a symbolic link from /etc/apache2/conf-enabled/phpldapadmin.conf to /etc/phpldapadmin/apache.conf since it didn't work by default (it creates a file in the Apache conf.d directory, which is not read since it doesn't end in .conf).
But now, when I access the phpldapadmin document root at domain.com/phpldapadmin, it shows the following error and doesn't render the index page:
Fatal error: Cannot redeclare password_hash() in /usr/share/phpldapadmin/lib/functions.php on line 2225
I tried installing it from source and got the same error, although in a different line number. So I'm guessing it's probably a configuration error on my part. The config.php file is huge so I'm a bit lost here. Has anyone experienced the same error? Or could anyone give me some pointers to narrow down the problem? I figured that at least it should display the login page, even if the connection information for the LDAP server is all wrong.
I'm sorry if this is forum is not the correct place to ask this, the bug tracker at http://sourceforge.net/p/phpldapadmin/bugs/ seems to no longer be in use and I can't figure out where else can I ask for help.
Thank you.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
phpldapadmin PHP error
Re: phpldapadmin PHP error
I had to rename the password_hash function because it is incompatible with the built-in one and storing passwords didn't work. So just rename the function for something like pla_password_hash at:
/usr/share/phpldapadmin/lib/functions.php lines 2130, 2311 and 2320
/usr/share/phpldapadmin/lib/PageRender.php line 289
I get a couple of warnings on the main page though (deprecated functions and such), so I guess the phpldapadmin code is a bit outdated with respect to the current PHP version.
Edit: the warnings are fixed by replacing all calls to preg_replace which use the /e modifier with the newer preg_replace_callback function, which is apparently safer. So that would be:
At /usr/share/phpldapadmin/lib/functions.php line 2549 and /usr/share/phpldapadmin/lib/ds_ldap.php line 1120:
Replace
With
At /usr/share/phpldapadmin/lib/functions.php line 2554 and /usr/share/phpldapadmin/lib/ds_ldap.php line 1125:
Replace
With
I am no PHP programmer, so this could very well be wrong. I'll try to contact the developer with these issues, but it seems as if this software is no longer under development, judging by the date of the latest version and the activity in the Sourceforge page... it's a pity since I couldn't find any other web-based management tools for OpenLDAP.
/usr/share/phpldapadmin/lib/functions.php lines 2130, 2311 and 2320
/usr/share/phpldapadmin/lib/PageRender.php line 289
I get a couple of warnings on the main page though (deprecated functions and such), so I guess the phpldapadmin code is a bit outdated with respect to the current PHP version.
Edit: the warnings are fixed by replacing all calls to preg_replace which use the /e modifier with the newer preg_replace_callback function, which is apparently safer. So that would be:
At /usr/share/phpldapadmin/lib/functions.php line 2549 and /usr/share/phpldapadmin/lib/ds_ldap.php line 1120:
Replace
Code: Select all
preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
Code: Select all
preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',function(){return "''.chr(hexdec('\\1')).''";},$rdn);
Replace
Code: Select all
preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
Code: Select all
preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',function(){return "''.chr(hexdec('\\1')).''";},$dn);
Re: phpldapadmin PHP error
Thank you chema! I had the same problem (Installed phpldapadmin today on Ubuntu 13.10 via apt-get) and your fix worked like a charm
Re: phpldapadmin PHP error
The information above is perfect for fixing the page so it renders.
I found there is at least one other place that needs the change so the creation templates render without errors.
At /usr/share/phpldapadmin/lib/TemplateRender.php line 2469:
Replace
With
Hope this helps anyone else looking for this fix.
I found there is at least one other place that needs the change so the creation templates render without errors.
At /usr/share/phpldapadmin/lib/TemplateRender.php line 2469:
Replace
Code: Select all
$default = $this->getServer()->getValue('appearance','password_hash');
Code: Select all
$default = $this->getServer()->getValue('appearance','pla_password_hash');
Re: phpldapadmin PHP error
I posted this for any users searching out same error since the OP has already solved problem.
Here is a patch: https://bugs.debian.org/cgi-bin/bugrepo ... lity.patch
That I got from this bug report, worked like a charm for me: https://bugs.debian.org/cgi-bin/bugrepo ... bug=710854
Here is a patch: https://bugs.debian.org/cgi-bin/bugrepo ... lity.patch
That I got from this bug report, worked like a charm for me: https://bugs.debian.org/cgi-bin/bugrepo ... bug=710854