Ports needed for LDAP connection

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TheChosenOne
Forum Newbie
Posts: 2
Joined: Mon Oct 14, 2013 11:43 am

Ports needed for LDAP connection

Post by TheChosenOne »

Hi

I have the next set up:
A server (1) that is reachable from the internet and an internal server (2) that is not reachable externally, but can be reached through server 1.
Now. When I run next script on server 1, everything works. 'startsuccess!' is printed.

Code: Select all

<?php
echo "start";
$host = 'server2';
$port = '389;
$ds = ldap_connect($host, $port);
echo "success!";
?>
When I run this on my local pc, it doesn't work.
I forward port 389 to port 1337. This tunnel should work, because portforwarding of other ports (like 22) work.
This is the script I run locally:

Code: Select all

<?php
echo "start";
$host = 'localhost';
$port = '1337;
$ds = ldap_connect($host, $port);
echo "success!";
?>
Only 'start' is printed out.

Am I doing something wrong, or do I have to forward more ports?

Thanks!
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Ports needed for LDAP connection

Post by Celauran »

Is this the exact script, including the missing quote after 389? Is error reporting turned on? What errors are you getting?
TheChosenOne
Forum Newbie
Posts: 2
Joined: Mon Oct 14, 2013 11:43 am

Re: Ports needed for LDAP connection

Post by TheChosenOne »

Thanks! Error reporting did the trick!
"Call to undefined function: ldap_connect()"
-> Had to install php5-ldap.

Problem solved.
Post Reply