Create database during installation process

Discuss everything related to PHP Easy Installer. All versions. Any questions related to the PHP Easy Installer developing or using should be posted to this forum.

Moderator: alexandrleonenko

swertschak
Newbie
Newbie
Posts: 3
Joined: Nov 23rd, '13, 13:14

Create database during installation process

Postby swertschak » Nov 23rd, '13, 13:24

Hello,

I'm using EasyInstaller Pro Version. Everything is ok, if the database already exists. But if the database not exist I cannot create the database during the installation process. Is there a special flag for this or how can I do this ? The Flag "EI_DATABASE_CREATE" is set to "true". If I enter username and password of an existing database user with root rights, the error mesage "SQLSTATE[42000] [1049] Unknown database wikijournals" will be shown

Kind regards
swertschak

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Create database during installation process

Postby administrator » Nov 24th, '13, 08:53

In complete_installation.php file there is following line of code:

Code: Select all

if(EI_DATABASE_CREATE && ($install_type == 'create') && !$db->Create()){
    $error_mg[] = $db->Error();         
}....



Please debug it to understand what exactly happens.

swertschak
Newbie
Newbie
Posts: 3
Joined: Nov 23rd, '13, 13:14

Re: Create database during installation process

Postby swertschak » Dec 1st, '13, 15:52

I set the EI_Mode to "debug" but nothing happens. No errors wil be written into the php erro log. On the interface I get the message "SQLSTATE[HY000] [1049] Unknown database wikijournals"

Regards
swertschak

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Create database during installation process

Postby administrator » Dec 2nd, '13, 07:23

1. You have to debug following code:
if(EI_DATABASE_CREATE && ($install_type == 'create') && !$db->Create()){
$error_mg[] = $db->Error();
}

2. To create database you must have appropriate rights! Generally the user that uses installation wizard doesn't have them.
Please check if your db user has rights to create database.

swertschak
Newbie
Newbie
Posts: 3
Joined: Nov 23rd, '13, 13:14

Re: Create database during installation process

Postby swertschak » Dec 9th, '13, 20:30

Can it be, that the correct file for debugging is database_settings.php instead of complete_installation.php ?

administrator wrote:1. You have to debug following code:
if(EI_DATABASE_CREATE && ($install_type == 'create') && !$db->Create()){
$error_mg[] = $db->Error();
}

2. To create database you must have appropriate rights! Generally the user that uses installation wizard doesn't have them.
Please check if your db user has rights to create database.

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Create database during installation process

Postby administrator » Dec 10th, '13, 07:41

It depends what exactly you want to debug.
database_settings.php also performs a check of database connection.

PeterS
Newbie
Newbie
Posts: 1
Joined: May 20th, '14, 11:40

Re: Create database during installation process

Postby PeterS » May 20th, '14, 11:50

We use the version ApPHP EasyInstaller Pro, but do not know how I can create a new database. I tried using a user with privileges to create a database,
but I get the message "SQLSTATE[42000] [1049] Unknown database ....".

In database settings have paramater :
define('EI_DATABASE_CREATE', true);

Please how to create a new database from the installer?

administrator
Site Admin
Site Admin
Posts: 6010
Joined: Jan 7th, '09, 23:18
Contact:

Re: Create database during installation process

Postby administrator » May 21st, '14, 05:57

Debug Create() method in
include/database.class.php file


Return to “ApPHP Easy Installer {developers/users}”