Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Ports needed for LDAP connection

General discussions related to php

Moderators: macek, egami, gesf

Ports needed for LDAP connection

Postby TheChosenOne » Sat Oct 12, 2013 7:06 am

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!
TheChosenOne
New php-forum User
New php-forum User
 
Posts: 4
Joined: Sat Oct 12, 2013 7:04 am

Re: Ports needed for LDAP connection

Postby johnj » Thu Oct 17, 2013 10:02 pm

make sure no other application is using 1337
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Ports needed for LDAP connection

Postby TheChosenOne » Fri Oct 18, 2013 3:19 pm

Yes. No other application is running on this port.
TheChosenOne
New php-forum User
New php-forum User
 
Posts: 4
Joined: Sat Oct 12, 2013 7:04 am

Re: Ports needed for LDAP connection

Postby johnj » Tue Oct 22, 2013 5:19 am

when you use port 1337, what does ldap_connect() return? Please write appropriate error trapping functions to see what the error is.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Ports needed for LDAP connection

Postby TheChosenOne » Sun Oct 27, 2013 6:11 pm

johnj wrote:when you use port 1337, what does ldap_connect() return? Please write appropriate error trapping functions to see what the error is.

It doesn't return anything.
This is the (modified) code:
Code: Select all
<?php
echo "variables";
$host = 'localhost';
$port = 1337;
echo "connect";
try{
        $ds = ldap_connect($host, $port);
}
catch(Exception $e){
        echo "Exception";
}
echo "success!";
?>

"variablesconnect" is printed.
TheChosenOne
New php-forum User
New php-forum User
 
Posts: 4
Joined: Sat Oct 12, 2013 7:04 am

Re: Ports needed for LDAP connection

Postby TheChosenOne » Sun Oct 27, 2013 6:16 pm

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

Problem solved.
TheChosenOne
New php-forum User
New php-forum User
 
Posts: 4
Joined: Sat Oct 12, 2013 7:04 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron