3v4l.org

run code in 300+ PHP versions simultaneously
<?php $baseDN = "dc=challenge01,dc=root-me,dc=org"; $ldapServer = "challenge01.root-me.org"; $ldapServerPort = 54013; $rdn="admin"; $mdp="%00"; $dn = 'dc=challenge01,dc=root-me,dc=org'; echo "Connexion au serveur"; $conn=ldap_connect($ldapServer); // on teste : le serveur LDAP est-il trouvé ? if ($conn) echo "Le résultat de connexion est ".$conn ."<br />"; else die("connexion impossible au serveur LDAP"); if (ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 2)) { echo "Utilisation de LDAPv3 \n"; } else { echo "Impossible d'utiliser LDAP V3\n"; exit; } if ($bindServerLDAP) echo "Le résultat de connexion est $bindServerLDAP <br />"; else die("Liaison impossible au serveur ldap ..."); echo "Recherche suivant le filtre (sn=B*) <br />"; $query = "sn=B*"; $result=ldap_search($conn, $baseDN, $query); echo "Le résultat de la recherche est $result <br />"; echo "Le nombre d'entrées retournées est ".ldap_count_entries($conn,$result)."<p />"; echo "Lecture de ces entrées ....<p />"; $info = ldap_get_entries($conn, $result); echo "Données pour ".$info["count"]." entrées:<p />"; for ($i=0; $info["count"]; $i++) { echo "dn est : ". $info[$i]["cn"] ."<br />"; echo "premiere entree cn : ". $info[$i]["cn"][0] ."<br />"; echo "premier email : ". $info[$i]["mail"][0] ."<p />"; } echo "Fermeture de la connexion"; ldap_close($conn); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Connexion au serveur Fatal error: Uncaught Error: Call to undefined function ldap_connect() in /in/Pa0hI:10 Stack trace: #0 {main} thrown in /in/Pa0hI on line 10
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Connexion au serveur Fatal error: Uncaught Error: Call to undefined function ldap_connect() in /in/Pa0hI:10 Stack trace: #0 {main} thrown in /in/Pa0hI on line 10
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Connexion au serveur Fatal error: Call to undefined function ldap_connect() in /in/Pa0hI on line 10
Process exited with code 255.

preferences:
191.72 ms | 401 KiB | 294 Q