26 Sep 07
Delete all values of an LDAP attribute in PHP
ldap_mod_del( $connection, $dn, array( 'attrib-name' => array() ) );
Copy a directory recursively and keep the symlinks- use cp -R
- not cp -r
Relative inclusion of files using include/require in PHP
from comments on www.php.net: When I'm dealing with a package that uses relative includes of its own, rather than modify all of their includes, I found it was easier to change PHP's working directory before and after the include, like so:
<?
$wd_was = getcwd();
chdir(“/path/to/included/app”);
include(“mainfile.php”);
chdir($wd_was);
?>
This way neither my includes nor theirs are affected; they all work as expected. Or:
ini_set(‘include_path’, (ini_get(‘include_path’).’;’.$SITEROOT_PATH));
PHP ldap_mod_del()
– it requires attribute values to be indexed by consecutive int keys starting at 0!
PHP debuggers
http://uk3.php.net/debug_backtrace
http://uk.php.net/manual/en/function.class-exists.php
http://www.ibm.com/developerworks/library/os-debug/
http://pecl.php.net/package/apd
http://xdebug.org
– installs OK on Mac OS X 10.4
– if you activate it in php.ini, then commandline PHP stops working!
– error traces refer to PHP sources with lines starting at 0, not starting at 1!
http://gubed.mccabe.nu/?/article/articleview/Download&Gubed=f06cc6837ecb7ab00b0cb1791ad8274e&themex=public
When updating/creating an LDAP object in PHP and you get a funny attribute value
- if the attribute schema is a DN to (any) object
- and if the attrib value shows up as [Root] in ConsoleOne of Novell eDirectory
- and if the attrib values shows as null/empty string in PHP ldap_search and commandline ldapserch
- then you saved/created the object passing PHP null as the value of that attribute to PHP ldap_mod_add()
- solution: remove PHP null values when creating a new LDAP object. If updating an existing LDAP object, remove any existing values of that attribute by ldap_mod_del()