sipcapture / homer-api

HOMER 5: Back-End (API) DEPRICATED - use sipcapture/homer-app
http://sipcapture.org
27 stars 67 forks source link

Cannot login after installation #39

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi,

I've just installed the Homer 5 Beta but I cannot login with the default user (admin/test123). I get "Email and password combination not recognised". (also tried admin@test.com/test123) How can i find out what is wrong? The apache logs don't show any errors, the database username and password work when I connect via phpmyadmin and/or mysql cli. Is there any way to enable more verbose logging?

adubovikov commented 9 years ago

check the reply from /api/session in your browser's console.

ghost commented 9 years ago

That returns 404 Not found. Did I copy the Homer-UI incorrectly?

adubovikov commented 9 years ago

no, you didn't read our FAQ

https://github.com/sipcapture/homer/wiki/HOMER-3.6#apache-mod_rewrite

lmangani commented 9 years ago

You are most likely running with misconfigured Apache2 settings affecting the API, make sure you are permitting AllowOverride All (see examples directory in Homer-UI)

ghost commented 9 years ago

Module rewrite is already enabled. And i placed that .htaccess file. The apache config is edited from the example. I will check everything again. The api/configuration.php is also from the example, but i see that define('APIURL',"http://localhost"); & define('APILOC',"/api/"); are not i that file. I'll try adding those.

adubovikov commented 9 years ago

stop, don't add this.

is your configure.php looks like this? https://github.com/sipcapture/homer-api/blob/master/api/configuration_example.php

adubovikov commented 9 years ago

if mod_rewrite enabled and Allowoverride set to All, be sure that api directory located in the web root

also check if your mod_rewrite is really enabled with <?php phpinfo(); ?>

ghost commented 9 years ago

phpinfo() also shows mod_rewrite loaded and the API directory exists at /var/www/sipcapture/htdocs/api with the following content:

drwxr-xr-x  7 www-data www-data  4096 Aug 13 12:54 .
drwxr-xr-x 13 www-data www-data  4096 Aug 13 13:11 ..
drwxr-xr-x  2 www-data www-data  4096 Aug 13 10:09 Authentication
-rw-r--r--  1 www-data www-data  6234 Aug 13 10:09 autoload.php
-rw-r--r--  1 www-data www-data   793 Aug 13 10:09 configuration_example.php
-rw-r--r--  1 www-data www-data   799 Aug 13 13:05 configuration.php
-rw-r--r--  1 www-data www-data 34520 Aug 13 10:09 COPYING
drwxr-xr-x  2 www-data www-data  4096 Aug 13 10:09 Database
-rw-r--r--  1 www-data www-data  48 Aug 13 12:54 .htaccess
-rw-r--r--  1 www-data www-data  7653 Aug 13 12:00 index.php
-rw-r--r--  1 www-data www-data  2980 Aug 13 10:09 preferences_example.php
-rw-r--r--  1 www-data www-data  2981 Aug 13 11:56 preferences.php
drwxr-xr-x  2 www-data www-data  4096 Aug 13 10:09 RestApi
drwxr-xr-x  2 www-data www-data  4096 Aug 13 10:09 RestService
drwxr-xr-x  2 www-data www-data  4096 Aug 13 10:09 Statistic

So it's most probably the configuration of apache not allowing the RestAPI to register paths?

My apache (it's apache 2.4.7) configuration looks like this:

# Loading mod_rewrite if not done jet
<IfModule !mod_rewrite.c>
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>
# Define virtual host for HOMER5 on standard http tcp port 80
<VirtualHost *:80>
        ServerAdmin root@assam.spykenet.local
        ServerName  athkatla.spykenet.local
        ServerAlias athkatla

        # Indexes + Directory Root.
        DirectoryIndex index.php index.html index.htm
        DocumentRoot /var/www/sipcapture/htdocs

        <Directory /var/www/sipcapture/htdocs>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>

        # CGI Directory
        ScriptAlias /cgi-bin/ /var/www/sipcapture/cgi-bin/
        <Location "/var/www/sipcapture/cgi-bin">
            Options +ExecCGI -MultiViews
            Require all granted
        </Location>

        # Logfiles
        LogLevel debug
        ErrorLog  /var/log/apache2/sipcapture-error.log
        CustomLog /var/log/apache2/sipcapture-access.log combined
</VirtualHost>
adubovikov commented 9 years ago

and if in browser you open:

http://athkatla.spykenet.local/api/session

what do you get ?

ghost commented 9 years ago

Also a 404

Since enabling LogLevel debug the following appeared in /var/log/apache2/sipcapture-error.log


[Thu Aug 13 13:36:25.472607 2015] [authz_core:debug] [pid 4324] mod_authz_core.c(802): [client 10.50.0.10:62918] AH01626: authorization result of Require all granted: granted, referer: http://athkatla/
[Thu Aug 13 13:36:25.472687 2015] [authz_core:debug] [pid 4324] mod_authz_core.c(802): [client 10.50.0.10:62918] AH01626: authorization result of <RequireAny>: granted, referer: http://athkatla/
[Thu Aug 13 13:36:25.472786 2015] [core:info] [pid 4324] [client 10.50.0.10:62918] AH00128: File does not exist: /var/www/sipcapture/htdocs/api/session, referer: http://athkatla/
adubovikov commented 9 years ago

so, your mod_rewrite and allowoverride doesnt work for this virtual hosts. Sorry, but you should check apache's doc

as tip, please define separate Directory record for /var/www/sipcapture/htdocs/api

adubovikov commented 9 years ago

any feedback ?

ghost commented 9 years ago

Yes, could not get it working with Apache on a clean Ubuntu 14.04.3 system, definitely something wrong with the configuration of mod_rewrite. Beyond my troubleshooting capabilities. So I switched to nginx, that works. Thanks for the assistance.

On Fri, Aug 14, 2015, 10:47 Alexandr Dubovikov notifications@github.com wrote:

any feedback ?

— Reply to this email directly or view it on GitHub https://github.com/sipcapture/homer-api/issues/39#issuecomment-131028835 .

adubovikov commented 9 years ago

ok, thanks

alaertegv commented 4 years ago

Hi GHOST, I am facing same problem as your were, could you point me details about your solution "switched to nginx"?

Thanks