This module provides an easy way to install database. Things you can configure are:
- database username
- database password
- database name
- sql file to run(either from upload or from data folder in module)
- database driver
Once you enter this data, script will first create database if it is not already present, save configuration to config file inside module config folder and run the selected sql file.
I know this could easily be achieved by command line, but this is a nice way to allow non-technical users an easier install of database and it's configuration.
Requirements ¶
Yii Framework 1.1.14
Sql file to create your database
Installation ¶
First clone the repository on Github ~~~ git clone https://github.com/Pintar/yii-database-installer.git ~~~
Copy modules folder inside your projects protected folder.
Ensure that protected/modules/installer/config/params.php is writable.
Add to protected/config/main.php the following:
'modules' => array(
'installer' => array(
'redirectUrl' => 'site/index', // controller action you want to redirect in case installation has been completed
'allowSqlUpload' => true, // set this to true if you want to manually upload sql file to run. Otherwise script will look in data folder of the module.
),
),
'db' => require(dirname(__FILE__).'/../modules/installer/config/params.php'),
Usage ¶
Once you have installed the module, go to installer/install on your web browser and fill out the form.
params.php uses the short_open_tag format
The params.php file starts with <? which requires that short_open_tag = On. However, the default is now recommended to be Off, which causes the require to return a long rather than an array!
short_open_tag issue
Hello TheLondoner,
I changed tags from <? to <?php tags in params.php file as well as in model.php file, where connection to database is saved to file.
Regards,
Pintar
Thank you!
This extension does exactly what I needed.
Get error CDbConnection.connectionString cannot be empty.
After setup as guide, I get the error: CDbConnection.connectionString cannot be empty.
Pls help me fix it. Thank so much.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.