Menu

Fresh install didn't go well...

Help
2020-10-02
2020-10-02
  • David Smart

    David Smart - 2020-10-02

    I'm trying to do a fresh install onto a server, and unfortunately it isn't going well.

    I pulled all files from https://sourceforge.net/p/phpgedview/svn/HEAD/tree/trunk/phpGedView/
    and located them at <server>/gen/</server>

    Further down on that page are the requirements and quick install instructions.
    My server meets the requirements as best I can tell - hosting other db.
    I'm using MariaDB 10 (10.3.21-0063), which might be related to this.
    I'm also using PHP 7.2.

    I had an older phpGedView running on the same server with MariaDB 5 and that worked (and it used PHP 7.2). It appears that MariaDB 10 is the primary difference I'm seeing.

    Following the quick install I ran a ground in the installation wizard on step 2 Database Connection.

    I filled in the form and hit next. It returned to this same step with

    Your current database configuration is bad. Please check your database connection parameters and configure again.
    SQLSTATE[HY000] [2002] No such file or directory
    

    Using phpmyadmin, and the same set of credentials and parameters, I could connect to the mysql server and browse other existing db's.

    I found where "Your current database configuration is bad..." comes from in install.php

                    PGV_DB::createInstance(
                        $_SESSION['install_config']['DBTYPE'],
                        $_SESSION['install_config']['DBHOST'],
                        $_SESSION['install_config']['DBPORT'],
                        $_SESSION['install_config']['DBNAME'],
                        $_SESSION['install_config']['DBUSER'],
                        $_SESSION['install_config']['DBPASS'],
                        $_SESSION['install_config']['DB_UTF8_COLLATION']
                    );
                } catch (PDOException $ex) {
                    $step=2;    // For any DB error, re-do Step 2
                    $errors[]=array(
                        'msg'=>$pgv_lang['db_setup_bad'],        <===============
                        'help'=>$ex->getMessage()
                    );
                }
    

    I tried sorting out what went wrong with createInstance, and it appears to be the "new PDO"

            case 'mysql':
                self::$pdo=new PDO(
                    "mysql:host={$DBHOST};dbname={$DBNAME};port={$DBPORT}", $DBUSER, $DBPASS,
                    array(
                        PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION,
                        PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_OBJ,
                        PDO::ATTR_CASE=>PDO::CASE_LOWER,
                        PDO::ATTR_AUTOCOMMIT=>true
                    )
                );
    

    This is where some advice will be welcome ...

     
  • Gerry Kroll

    Gerry Kroll - 2020-10-02

    It's probably line 133 of /includes/classes/class_pgv_db.php

            self::$DB_ENGINE    ='ENGINE=MyISAM';
    

    Most db types have this value empty. Try changing line 133 of /includes/classes/class_pgv_db.php accordingly.

     
  • David Smart

    David Smart - 2020-10-02

    Thanks for the fast response Gerry! I set the line to

    self::$DB_ENGINE = '';
    

    an have the same issue.

    Then I inserted a couple of printf(...); like this:

    case 'mysql':
        printf("Hello from line %d<br/>\n", __LINE__);
        self::$pdo=new PDO(
            "mysql:host={$DBHOST};dbname={$DBNAME};port={$DBPORT}", $DBUSER, $DBPASS,
            array(
                PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE=>PDO::FETCH_OBJ,
                PDO::ATTR_CASE=>PDO::CASE_LOWER,
                PDO::ATTR_AUTOCOMMIT=>true
            )
        );
        printf("Hello from line %d<br/>\n", __LINE__);
        self::$AUTO_ID_TYPE ='INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY';
        self::$ID_TYPE      ='INTEGER UNSIGNED';
    

    I see line 110 (the first one), but never the second one.

     
  • Gerry Kroll

    Gerry Kroll - 2020-10-02

    OK, revert /includes/classes/class_pgv_db.php back to its original version.

    The text, "SQLSTATE[HY000] [2002] No such file or directory" indicates what's wrong.

    Here's a discussion of the problem and its solutions:
    https://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory

    I found this by googling the text of the actual error message (the line below "Your current database configuration is bad. ...".)

    The first, and easiest, thing to try is to change the configuration to say "127.0.0.1" instead of "localhost".

     
  • David Smart

    David Smart - 2020-10-02

    Solved! Thanks for you guidance!

    I may have had more than one issue - because I was making changes from my own research along the way.
    * I changed to 127.0.0.1 (likely this was the solution)
    * I reset the db password using phyMyAdmin
    * I launched mysql from the command line to test the connection

    And it is now working from a fresh install.

     
  • Gerry Kroll

    Gerry Kroll - 2020-10-02

    Great. I'm glad things are OK now.

     

Log in to post a comment.