perl ldap start_tls Operations error

When i use php script to call perl script which will query the ldap , the perl function start_tls always return the error message “Operations error”, but it works well when call perl script directly with command line, it almost spent me a day to fix this problem, i finally found the root cause is that php process doesn’t have read permission to the cert/key file

chmod a+r /path/to/cert file

chmod a+r /path/to/key file

those two commands fixed the problem.

following code demo how php call perl:

$pipespec = array
    (
    1 => array('pipe', 'w'), // client's stdout
    2 => array('pipe', 'w'), // client's stderr
);

$pipes = array();
$command = "/usr/bin/perl /path/to/perl/script.pl";
$process = proc_open($command, $pipespec, $pipes, $cwd, NULL);

Continue reading perl ldap start_tls Operations error