I am trying to get ldap_connect to work properly. It will work fine via CLI, but not when I open my php file via browser.
Here is what I believe are the relevant details:
Lines added to httpd.conf:
Things changed in php.ini:
I'm pulling my hair out, so I am more than happy to try anything people suggest.
Your PHP installation uses two different ini files - one when running from the command line, and a different one when running through Apache. This is evidenced by the fact that it works from the CLI, but not in a browser.
You can find the paths to the two files using phpinfo()
(in a browser) and by passing the -i
flag to php
from the command line. Near the top of both sets of output you will find the path to the ini file in use, and I would be mighty surprised if they were identical. From the command line you can get more detailed information by passing the --ini
flag.
The fact that you are getting Call to undefined function ldap_connect()
can only mean that the LDAP extension was not loaded, and this can only be true through Apache but not through the CLI if they use two different ini files.
I feel silly now. The problem was with adding my PHP directory to the PATH environment variable. I'm not 100% sure why it fixed the problem, but that was what ended up doing it. Thanks for the help, guys!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.