Link to home
Start Free TrialLog in
Avatar of trevor1940
trevor1940

asked on

PHP: Errors in Apache log and console

Hi

I'm attempting to install Apachie-Jena  Fuseki  and Skosmos  in windows 10 following this guide    which uses XAMPP

When I try and test Skosmos using test data from here loading-data

All good so far the data is loaded and reports correctly  however when I try and view the data in Skosmos I get the following in Apache logs

[Wed Jan 08 12:02:25.561396 2020] [php7:notice] [pid 11176:tid 1944] [client ::1:58254] PHP Notice:  Undefined index: http://www.w3.org/2004/02/skos/core#Concept in C:\\xampp\\htdocs\\skosmos\\controller\\RestController.php on line 288, referer: http://localhost:8080/skosmos/stw/en/
[Wed Jan 08 12:02:25.694397 2020] [php7:notice] [pid 11176:tid 1936] [client ::1:58263] PHP Notice:  Undefined offset: 0 in C:\\xampp\\htdocs\\skosmos\\controller\\WebController.php on line 642, referer: http://localhost:8080/skosmos/stw/en/

Open in new window


and in Chrome dev tools
http://localhost:8080/skosmos/resource/css/stylesheet.css net::ERR_ABORTED 404 (Not Found)
jquery.min.js:4 GET http://localhost:8080/skosmos/rest/v1/types?lang=en 500 (Internal Server Error)

Open in new window



I'm not total sure what line 288 of RestController.php is doing the web page "http://www.w3.org/2004/02/skos/core#Concept" doesn't exist but in a browser gets redirected to https://www.w3.org/2009/08/skos-reference/skos.html#Concept I attempted to change the urls but  it still fails
WebController.php
RestController.php
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

What the error is saying is that in the following code (line 256)
$vocabStats = $request->getVocab()->getStatistics($request->getQueryParam('lang'), $arrayClass, $groupClass);

Open in new window

There is no array element with index http://www.w3.org/2004/02/skos/core#Concept

One option is to dump the vocabStats variable to see what is in there (put after line 256)
print_r($vocabStats);

Open in new window


This might give a clue.

Is the RestController.php file one you created or is it part of a framewrok?
Are you using Apache http or tomcat? Or you need both?
Question based on port 8080 use

What is the error on the command when you check php code for syntax. It is possible that you are missing php modules that are used.

The URL is informational and commonly would not be the cause of the error.

The log entry is a notification it is not considered an error.

it suggests a variable, reference is being used that was not previously defined.
It might be the php uses strict meaning anything used needs to be predeclared.
I.e you define $variable while in the code $Variable ....
That typo will generate a notice for an undefined , ....

Much depends on your preference, php.ini could be adjusted to report info, warning, error and critical .
Info is one level up from notice.

Look at preceding lines above 288 to see what triggers. It complains about an index.

Have not used the underlying package so comments are solely to deal based on errors/notifications.
Avatar of trevor1940
trevor1940

ASKER

Julian

Both files are part of install

I wrote this after line 256

        echo "hello [";
        print_r($vocabStats);
        echo "] World";

Open in new window


This didn't appear to print anything I was exacting to see hello [] World at the very  least


arnold

Are you using Apache http or tomcat? Or you need both
I'm using XAMPP however Fuseki   can be run under tomcat I've not got that far
This page generates the errors in the log and fails to load properly (there is a loading gif)
 
http://localhost:8080/skosmos/stw/en/

It also generates  in chrome console
Skosmos.JPG
1) PHP Notices: are simply warnings. And PHP usually promotes these to Fatals in future PHP releases.

Be sure to start with all latest software, then open dev tickets to fix these warnings.

2) The 500 error is a result of a 404 error, which appears to be a missing /skosmos/resource/css/stylesheet.css file which you must resolve to make progress.

Looks like this missing file is the only real blocker (Fatal error).
Aside: This is going to be very complex to get working on Windows.

If you're looking for how to get this working quickly + keep it working easily, https://github.com/NatLibFi/Skosmos/wiki/InstallTutorial provides a guide for this.
David

I copied style.css to /skosmos/resource/css/stylesheet.css  that fixed the 404 but didn't fix the 500 error

The link you gave is for Ubuntu I posted in my opening question

Company policy is Windows :(

Arnold you suggested I might be missing modules How do I Work out what could be missing and install  them?

You also suggested modifying php.ini ??
Notice the log entry is from php7.notice

One the command line when you run php -c ..

You have to look at the two packages you are using to see what their requirements are and what they need.
Php.net for download of modules.
To resolve the 500 error now, check your Apache error.log file which will show you the exact file name + line number raising the 500.
Note: I find no reference in the Apache docs about compatibility of mpm_winnt with the HTTP/2 protocol.

If Company revenue revolves around Website speed, best do some research about this, as HTTP/2 fixes achieves much better performance across many various traffic patterns + site designs... so... Company Policy might require revisiting... if HTTP/2 is required...

Docs suggest mpm_winnt + http2 are incompatible.
This didn't appear to print anything I was exacting to see hello [] World at the very  least
Then put a die() after the code to force the script to stop at that point
echo "hello [";
print_r($vocabStats);
echo "] World";
die();

Open in new window


The error is very clear - an index in an array is not being found - we need to find out
a) where the data for the array is coming from
b) that it is being populated correctly
David

The browser showing the 500 error, I'm getting, is a jQuery call which runs a SPARQL query I  need to work out what is making this call
No idea what your getting at with last comment about mpm_winnt

Julian Please Hold I'll check now and let you know
Julian

Didn't do anything except stop an entry in the log

No message to browser
Does not make sense. If the code is erroring out further down then that should dump the data to the screen.

Try this (instead of what you have)

file_put_contents('$$$debug.log', print_r($vocabStats, true));

Open in new window

That's all - drop the echo's and the die.

Then check for a file called debug.log and see what is in it.

NB: change the $$$debug.log to a unique name that fits in with your project. I used this to try and limit overlap with existing files you don't want to overwrite.
Julian

I Get

Array
(
)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of trevor1940
trevor1940

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Seems my last reply was lost.

Basically - the fact you are getting an empty array says that something in the framework went wrong. That array is supposed (based on the code that comes after) to be populated with data.

To solve this problem we would need to trace back to where the array is supposed to be populated and see why it is not.
Julian

My guess is the PHP error is related to the jquery 500 error

I attempted to trace where this is being made but failed

Also did a dump of  $request to see if that shed light it didn't

    public function vocabularyStatistics($request)
    {
       file_put_contents('C:\Temp\debug.log', print_r($request, true) . PHP_EOL, FILE_APPEND);
        $this->setLanguageProperties($request->getLang());
        $arrayClass = $request->getVocab()->getConfig()->getArrayClassURI();
        $groupClass = $request->getVocab()->getConfig()->getGroupClassURI();
        $vocabStats = $request->getVocab()->getStatistics($request->getQueryParam('lang'), $arrayClass, $groupClass);
        file_put_contents('C:\Temp\debug.log', print_r($vocabStats, true). PHP_EOL, FILE_APPEND);

.......... ++

Open in new window


Not totally sure what in $request is being searched but

Request Object
(
    [lang:Request:private] => en
...++

Open in new window


I'm willing to reopen or start a new post if your willing to work through this further?