From: Operating system: RHEL 6.2 PHP version: Irrelevant Package: LDAP related Bug Type: Bug Bug description:ldap_start_tls issue only when running script via apache not php(cli)
Description: ------------ Enviroment: RHEL 6.2 Apache/2.2.15 (Unix) - httpd-2.2.15-15.el6.x86_64 PHP 5.3.3 (cli) (built: Oct 24 2011 08:35:41) - php-cli-5.3.3-3.el6_1.3.x86_64, php-ldap-5.3.3-3.el6_1.3.x86_64 -- When running test script via php -f sample_ldap.php with /etc/openldap/ldap.conf configured with TLS_REQCERT never, script returns OK and successfully establishes SSL(or TLS) connection with LDAP server(W2k8 R2 DC). Running same script via apache ends up with ERROR and following message in apache error log: --snip-- ldap_connect_to_host: Trying 10.1.1.10:636 ldap_pvt_connect: fd: 15 tm: -1 async: 0 TLS: could not add the certificate PEM Token #0:dc1CAchain.cert - 0 - error -8192:Unknown code ___f 0. TLS: error: could not initialize moznss security context - error -8192:Unknown code ___f 0 TLS: can't create ssl handle. --snip-- Test script can be easily converted to use TLS method and this one fails with exactly same error in error log. Running same script on CentOS 5.8 with apache 2.2.3/PHP 5.1.6 - no issues with TLS or SSL. Test script: --------------- <?php $ldap="ldaps://ldap.company.corp:636"; $usr="u...@company.corp"; $pwd="password111"; ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 255); $ds=ldap_connect($ldap); $ldapbind=false; if ($ds) { if(ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) if(ldap_set_option($ds, LDAP_OPT_REFERRALS, 0)) $ldapbind = @ldap_bind($ds, $usr, $pwd); ldap_close($ds); } if(!$ldapbind) echo "ERROR"; else echo "OK"; ?> Expected result: ---------------- Script returns OK if successfull bind has been made, otherwise ERROR message appears -- Edit bug report at https://bugs.php.net/bug.php?id=60542&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60542&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60542&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60542&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60542&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60542&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60542&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60542&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60542&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60542&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60542&r=support Expected behavior: https://bugs.php.net/fix.php?id=60542&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60542&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60542&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60542&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60542&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60542&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60542&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60542&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60542&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60542&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60542&r=mysqlcfg