Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in plugin.php #25

Closed
Adriviere opened this issue Aug 4, 2020 · 4 comments
Closed

Errors in plugin.php #25

Adriviere opened this issue Aug 4, 2020 · 4 comments

Comments

@Adriviere
Copy link

Hi,

I would like to use add the LDAP plugin to my YOURLS (which is working).

Once I activated the plugin (and set the variables in config.php), I try to log in with my LDAP account and there is an error 500.

I checked the nginx/error.log and this is the result:

2020/08/04 09:35:13 [error] 8230#8230: *6 FastCGI sent in stderr: "PHP message: PHP Warning: array_merge(): Argument #2 is not an array in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 286
PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /srv/YOURLS/includes/functions-http.php on line 309
PHP message: PHP Fatal error: Uncaught Error: Call to undefined function ldap_connect() in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php:114
Stack trace:
#0 /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php(164): ldapauth_get_ldap_connection()
#1 /srv/YOURLS/includes/functions-plugins.php(156): ldapauth_is_valid_user(false)
#2 /srv/YOURLS/includes/functions-auth.php(89): yourls_apply_filter('is_valid_user', false)
#3 /srv/YOURLS/includes/auth.php(5): yourls_is_valid_user()
#4 /srv/YOURLS/includes/functions-auth.php(14): require_once('/srv/YOURLS/inc...')
#5 /srv/YOURLS/admin/index.php(4): yourls_maybe_require_auth()
#6 {main}
thrown in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 114" while reading response header from upstream, client: X.X.X.X server: my_server_name, request: "POST /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "my_server_name", referrer: "http://my_server_name/admin/"

In my opinion there are syntax errors in plugin.php, or I made a mistake somewhere.

@k3a
Copy link
Collaborator

k3a commented Aug 4, 2020

It looks like your PHP is not compiled with LDAP support. Function ldap_connect is supported in PHP 4 - 7 but has to be explicitly enabled during compilation.

@Adriviere
Copy link
Author

You were right.
I installed php-ldap and it's better now, but here is my error.log now:

**2020/08/05 08:32:40 [error] 1228#1228: *1 FastCGI sent in stderr: "PHP message: PHP Warning: array_merge(): Argument #2 is not an array in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 286

PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /srv/YOURLS/includes/functions-http.php on line 309

PHP message: PHP Warning: ldap_search(): Search: Can't contact LDAP server in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 190" while reading response header from upstream, client: X.X.X.X, server: my_server_name, request: "POST /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "my_server_name", referrer: "http://my_server_name/admin/"**

I'm interested by the first 2 errors

@Adriviere
Copy link
Author

I've modified the proxy conf and here is the nginx error.log now:

**2020/08/05 09:17:21 [error] 2271#2271: *4 FastCGI sent in stderr: "PHP message: PHP Warning: array_merge(): Argument #2 is not an array in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 286

PHP message: PHP Warning: ldap_search(): Search: Can't contact LDAP server in /srv/YOURLS/user/plugins/yourls-ldap-plugin/plugin.php on line 190" while reading response header from upstream, client: X.X.X.X, server: my_server_name, request: "POST /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "my_server_name", referrer: "http://my_server_name/admin/"**

@k3a
Copy link
Collaborator

k3a commented Aug 5, 2020

The first PHP warning is unimportant but I fixed it in the new commit.

" ldap_search(): Search: Can't contact LDAP server" means your configured LDAP server is not reachable from the PHP.

Check your LDAP configuration, credentials and ensure LDAP can be reached from the same sever.
You can use ldapsearch utility (a part of OpenLDAP) to do test queries.

@k3a k3a closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants