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);

if (!is_resource($process))
{
echo "Failed : " .  $command;
}

$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[1]);
fclose($pipes[2]);
echo "<br>stdout: " . $stdout;
echo "<br>stderr: " . $stderr;

One thought on “perl ldap start_tls Operations error”

  1. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why throw away your intelligence on just posting videos to your site when you could be giving us something enlightening to read?

Comments are closed.