Wednesday, April 30, 2014

ldap_bind(): Unable to bind to server: Protocol error
You have to specify the protocol version prior before making a call to ldap_bind(), when the server is expecting LDAP protocol version 3. else you will receive the above error

In order to avoid this, make this call:

<?php
ldap_set_option($ldapConnResult, LDAP_OPT_PROTOCOL_VERSION, 3);
?>

Where $ldapConnResult  is the result returned by ldap_connect() function.

Call to undefined function ldap_connect()

Call to undefined function ldap_connect()
Just go to php.ini file and un-comment php_ldap extension line

Thursday, April 24, 2014

PEM routines:PEM_read_bio:no start line

PEM routines:PEM_read_bio:no start line
 I got this error when I tried to convert a private key to PKCS12 format using openssl_pkcs12_export() function under PHP, after 48 hours of trying many solutions I finally found the wright one, it's soo simple just change the format of the private key (PEM encoded) from

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,25E7BB5EB27D828C

<--- Private key here ----->
-----END RSA PRIVATE KEY-----

to

-----BEGIN RSA PRIVATE KEY-----
<--- Private key here ----->
-----END RSA PRIVATE KEY-----
 
That's all !

I reported this error to PHP and it's published on function manual http://www.php.net/manual/en/function.openssl-pkcs12-export.php#114908

Wednesday, April 23, 2014

error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt error:0906A065:PEM routines:PEM_do_header:bad decrypt
I got this error while working with OpenSSL library  on PHP, this happen when you try to export the private key of a certificate using bad passphrase, just make sure taht you are using the wright one.