Avance Zone

Technical Experts Zone Blogs

PHP LDAP Connect with Bind, Serach, Fetch and Closing connection methord

PHP LDAP Connect with Bind, Serach, Fetch and Closing connection methord

Below function used to connect ldap through php programe, this working script is useful in checking and authenticating users in ldap for php login forms.

 
<?php
$all_users=array() ;
$ds='' ;
  $ds=ldap_connect('ldap.YourDomain.com','389')
  or die("Error while connecting to LDAP server") ;
# } # end if

if($ds)
 {
  $bind=ldap_bind($ds) or die("Error while binding with LDAP server");
  $search_result=ldap_search($ds,'ou=People,o=YourDomain.com','uid=username@YourDomain.com')
                  or die("Error while searching data in LDAP server") ;
  $ldap_entries=ldap_get_entries($ds,$search_result) ;
  $i=0;
print_r($ldap_entries);
  echo "<br>";
echo "$ldap_entries[0][dn]";
 
  echo "<br>";
  ldap_close($ds) or die("Error while closing LDAP connection") ;
 } # end if

?>

Solution for Error in Sending Mail in Simple Invoices Or symfony Mail server

Many Servers won’t allow masked domain name like localhost, This has to be replaced with ACTUAL mail server adrress like mail.YOURSERVERNAME.com

This will solve the mail issues and also Error in generating Invoces in SIMPLE INOICES application
Change the mail host in factories.yml in below path
/home/YOUR SERVER.COM/public_html/billing/lib/vendor/symfony/lib/config/config/factories.yml

mailer:
class: sfMailer
param:
logging:           %SF_LOGGING_ENABLED%
charset:           %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_SmtpTransport
param:
host:       mail.YOURSERVERNAME.com
port:       25
encryption: ~
username:   ~
password:   ~
|