Issues with New Installation

So I’ve been testing out spice for my company and I keep running into the same issue with the KREST API not working correctly.

When I go to /KREST/sysinfo I get a 500 error. There is no errors in any error log to point to what the potential problem could be.

And when I try to log in I get the message that “Url rewrite is not working. Please ensure you have enabled and configured url rewriting on this webserver.” I’ve checked everything that would point to URL rewriting to not be working but it’s working.

I feel like I am running in circles and the answer is obvious. Any ideas?

System Info:
OS: Fedora 27
PHP Version: 7.1

Orchid,

Just to make sure:
You installed latest SpiceCRM version 2018.01.00.
Your php.ini display_error setting is off
You followed instructions in http://www.spicecrm.io/download/krest-installation-guide/

Val

Val,

Yes I have the 2018.01.00 version of Spice.
My php.ini file has displey_errors as Off.
I installed KREST successfully per the installation guide (which was very helpful). I get a blank page and when I open the console I see a 500 Error on /KREST/sysinfo

Thank you!

Orchid,
in KREST/index.php
on line 18 there is
ini_set(‘error_reporting’, ‘E_ERROR’);
Comment this line
//ini_set(‘error_reporting’, ‘E_ERROR’);
Error reporting will then be set as in your php.ini. You probably shall get more entries in your php error log

Val

Thank you Val.

I see the error as below

[05-Mar-2018 13:50:17 America/Indiana/Indianapolis] PHP Fatal error: Uncaught Error: Call to undefined function getallheaders() in /var/www/spicecrm/KREST/KRESTManager.php:306
Stack trace:
#0 /var/www/spicecrm/KREST/index.php(87): KRESTManager->getProxyFiles()
#1 {main}
thrown in /var/www/spicecrm/KREST/KRESTManager.php on line 306

Orchid,

getallheaders() is a native php function for apache.
Is apache running under Fedora?
Is engine=on in your php,ini?

Val

I am running apache and engine is on.

I actually found the problem.

https://bugs.php.net/bug.php?id=62596

I’m running fedora 28 which would explain why I’m getting this issue.

Val,

I just wanted to let you know that I resolved the issue by adding the follow code to /KREST/index.php

if (!function_exists('getallheaders')) 
{ 
    function getallheaders() 
    { 
           $headers = []; 
       foreach ($_SERVER as $name => $value) 
       { 
           if (substr($name, 0, 5) == 'HTTP_') 
           { 
               $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; 
           } 
       } 
       return $headers; 
    } 
}

Orchid,
great job!
Val