CPanel with PHP4 and LDAP ???

mcn_doug

Member
Jan 18, 2010
8
0
51
Denver, CO, USA
I have been trying to configure our Cpanel server that is using php4 to be able to use the php ldap functions to make connections from our application to an LDAP server for authentication, and it doesn't seem to be working.

When configuring with EasyApache (Easy::Apache v3.2.0 Build 4986), I select apache 2 and php4 (4.4.7 to be precise). I then select all the LDAP options available to me under the Exhaustive Options list, which is LDAP and Auth LDAP. After waiting for the build to finish, I try testing this, I and am getting the following error:
Fatal error: Call to undefined function: ldap_connect() in <path_here>/test.php on line 9

When I look at the output file from easyapache I see:
-- Begin opt 'LDAP' --
-- Begin step 'to config options' --
-- End step 'to config options' --

-- End opt 'LDAP' --
and then
-- Begin opt 'Auth LDAP' --
-- Begin step 'to config options' --
-- End step 'to config options' --

-- End opt 'Auth LDAP' --

but then further down, under 'configuring php for apache and cli' , I see:
checking for LDAP support... no

I see the same thing also under 'configuring for system PHP':
checking for LDAP support... no

When it is checking for the necessary header files it shows:
checking for ldap.h... yes

The system is running CentOS 5.4. Checking for openldap packages shows:
openldap-2.3.43-3.el5
openldap-devel-2.3.43-3.el5
openldap-clients-2.3.43-3.el5

Do I need to install additional packages before running the build? Are there other options that I need to select with building with EasyApache?

Any help with this issue would be greatly appreciated.
--
Doug
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
You may want to try compiling it manually in the rawopts. Try adding this to /var/cpanel/easy/apache/rawopts/all_php4 and running EA again.

--with-ldap[=DIR]

See: PHP: Installation - Manual
What Vanessa detailed is correct; it should suffice to setup the entry as described and then rebuild PHP; specifying the directory is optional and may not be required. To clarify further, the LDAP option for Apache will only affect Apache/httpd; this will not affect PHP.

To check if the LDAP module is installed with Apache (not PHP), try the following commands via root SSH access:
Code:
# /usr/local/apache/bin/httpd -l
# /usr/local/apache/bin/httpd -M
 

mcn_doug

Member
Jan 18, 2010
8
0
51
Denver, CO, USA
CPanel and PHP4 with LDAP - Solved

Vanessa and Don,

Thank for you very much for your assistance. I was able to get this working this morning.

Just to leave some notes, in case someone is looking for this (or I need to again):
In /var/cpanel/easy/apache/rawopts/all_php4, the file all_php4 was not there, so I just created it, with each compile option on a line by itself:
Code:
--with-ldap=/usr/
--with-ldap-sasl=/usr/include/sasl/
The first time I did the compile with EA, I had --with-ldap=/usr/include/ that that gave an error. I found another place that said to leave off the include/, as it is automatically adding the include/ to the directory path that you give.

--
Doug