0

I am trying to adapt SimpleSAMLPHP for my Codeigniter app. However when I try to access the admin console located in third_party/simplesaml/www/index.php, I get an Internal Error Message while the url is

https://url.com/simplesaml/module.php/core/frontpage_welcome.php

Is there a way to properly access the index page? For some reason it keeps redirecting to this link and it won't load. Please help.

My Internal Error Message is just this

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@website.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Nothing appears in the log

This is my controller code

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class SAMLConfig extends CI_Controller {

    public function __construct() {        
        parent::__construct();
        $this->verify_admin_session();

    }

    public function index()
    {   
        $data = array();
//        $this->load->library('simplesaml'); 
         include APPPATH.'third_party/simplesaml/www/index.php';
        ini_set('display_errors', 1);
        ini_set('display_startup_errors', 1);
        error_reporting(E_ALL);
//        $data['action'] = "SAMLConfig";

    }

}

UPDATE: I am suspecting that my htaccess file may have something to do with it. Here it is

#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L,QSA]
#RewriteCond %{HTTPS} off
#RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
#RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #THIS LINE ALLOWS BASIC AUTH FOR REST DO NOT DELETE#
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) App/$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_URI} !^/php-fpm/*
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ App/index.php/$1 [L]
</IfModule>
JianYA
  • 2,750
  • 8
  • 60
  • 136
  • You'll need to post the Internal Error Message here. You'll also want to post the code. Right now all we know is you tried to use simplesamlphp with codeigniter and it didn't work, so we won't be able to help until we have more information. – Goose Mar 07 '18 at 15:38
  • Hi, thank you for the feedback. Sorry I can't give much info because I myself can't get much. The error doesn't show up in the log. I am unsure about what else I can provide – JianYA Mar 07 '18 at 15:46
  • It's nearly impossible to debug code if you don't have error messages. Does adding this to the start of the code help? https://stackoverflow.com/a/21429652/3774582 – Goose Mar 07 '18 at 15:49
  • I added my controller code. The display error stuff doesnt appear – JianYA Mar 07 '18 at 15:58
  • You've got to put the display error code at the start of the function. If you put it after the error, it won't report the error. You can also configure display errors in your php.ini, as well as error logging. Getting the errors is the first step, I can't imagine anyone debugging a problem error messages. – Goose Mar 07 '18 at 16:46
  • I added that in the beginning of the function. Nothing appears. I tried going to the frontpage_welcome page as well. Nothing appears. This is strange. – JianYA Mar 07 '18 at 21:03
  • Could this have something to do with my htaccess? – JianYA Mar 07 '18 at 21:03
  • You'll need to get error reporting working first. It'd be much quicker than trying to fix this problem blind. Read the rest of this Q&A https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display/21429652#21429652 and if you can't get it working, ask a new question about getting error reporting working. – Goose Mar 07 '18 at 21:29
  • Read this about your file and class naming https://www.codeigniter.com/user_guide/general/styleguide.html#class-and-method-naming –  Mar 07 '18 at 22:38
  • Dude you've posted three questions on this in the past 12 hours all containing similar information... This is not how you get an answer. – Alex Mar 08 '18 at 00:15
  • Sorry, I deleted one. The other one I got an answer to but the problem was different. – JianYA Mar 08 '18 at 00:22

1 Answers1

0

For anyone else having this issue - I have managed to get the admin area working by doing the following:

  1. Put your www folder in the htdocs folder (and probably the rest in a new folder within third_party)
  2. Add a Rewrite rule to your htaccess like so RewriteRule ^simplesaml/(.*)$ www/$1 [L]
  3. In www/_include.php amend the autoloader path to the absolute path of your _autoload.php file

I can now see the Sample installer. I would advise you to not call the folder www but something different so it cannot be publically accessed.

Additionally admin.protectindexpage should be set to true in config.php.

Antony
  • 3,875
  • 30
  • 32