Skip to content

Problem finding AbstractAdapter in mysqliAdapter #140

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

Closed
samuell opened this issue Mar 19, 2020 · 3 comments
Closed

Problem finding AbstractAdapter in mysqliAdapter #140

samuell opened this issue Mar 19, 2020 · 3 comments

Comments

@samuell
Copy link
Contributor

samuell commented Mar 19, 2020

I get a strange class loading problem.

System info

  • OS: Xubuntu 18.04 64 bit
  • Nginx 1.14.0
  • PHP: 7.2.24-0ubuntu0.18.04.3
  • MySQL: Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using EditLine wrapper
  • ARC2: 2.5.0

How to reproduce:

Install ARC2 2.5.0 with composer (e.g.) with:

composer require semsol/arc2 2.5.0 --update-no-dev

Create a database and a user, and give the user privileges to the database:

sudo mysql
> CREATE DATABASE smw;
> CREATE USER smw@localhost IDENTIFIED BY '*******';
> GRANT ALL ON smw.* TO smw@localhost;

Create a test file arc2test.php:

<?php
include_once("vendor/semsol/arc2/ARC2.php");
$store = ARC2::getStore(array(
    'db_host' => '127.0.0.1',
        'db_name' => 'smw',
        'db_user' => 'smw',
        'db_pwd'  => '*******',
        'db_adapter' => 'mysqli',
));
$store->createDBCon();

$isSetUp = $store->isSetUp();

echo "Is set up: " . $isSetUp;

echo "<pre>";
print_r($store);
echo "</pre>";

if ( !$isSetUp ) {
        $store->setUp();
}

(Adapt the database details to details of the database you created earlier).

Run the file in the web browser.

Expected behaviour

The web browser should show a functioning page, with the structure of the store object. The error log should not be populated.

Actual behavior.

The web browser gives a HTTP Error 500.

The error log of Nginx shows:

$ sudo tail -n 0 -f /var/log/nginx/error.log 
2020/03/19 19:03:02 [error] 892#892: *91 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'ARC2\Store\Adapter\AbstractAdapter' not found in /var/www/html/w/vendor/semsol/arc2/src/ARC2/Store/Adapter/mysqliAdapter.php on line 17
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /var/www/html/w/arc2test.php:0
PHP message: PHP   2. ARC2_Store->createDBCon() /var/www/html/w/arc2test.php:12
PHP message: PHP   3. ARC2\Store\Adapter\AdapterFactory->getInstanceFor() /var/www/html/w/vendor/semsol/arc2/store/ARC2_Store.php:88
PHP message: PHP   4. require_once() /var/www/html/w/vendor/semsol/arc2/src/ARC2/Store/Adapter/AdapterFactory.php:29" while reading response header from upstream, client: ::1, server: _, request: "GET /w/arc2test.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "localhost"
@samuell
Copy link
Contributor Author

samuell commented Mar 19, 2020

Closing as duplicate of #132.

One should do:

include_once("vendor/autoload.php"); // CORRECT!

... NOT like the following, as I did above:

include_once("vendor/semsol/arc2/ARC2.php"); // WRONG!

@samuell samuell closed this as completed Mar 19, 2020
@k00ni
Copy link
Collaborator

k00ni commented Mar 20, 2020

Hi @samuell, its good that you found a solution to your problem. I am wondering if our documentation about ARC2 setup needs more information about that?

@samuell
Copy link
Contributor Author

samuell commented Mar 20, 2020

Hi @k00ni , foremost I think the README is missing a link to the documentation in the GitHub wiki. It was only after a while I realized I should check the Wiki for the docs. I think a lot of people will not check the wiki, as most projects are using other ways to host the documentation.

Then, there is the question about whether the classical way should be mentioned, like here. Maybe with a caveat that some classes are not properly loaded that way?

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