Thanks for reply, Howard i tried both but still i am facing same issue.
I have created a simple script which will generate moodledata,config and database for moodle before userstarts the installation.
Moodle also does the same but my script is simple and sure it has some bugs. My code looks something like this
<?php
//Creating database for moodle
$con=mysqli_connect("localhost","root","123456");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create database
//$sql="CREATE DATABASE moodle11293 ";
//$sql="CREATE DATABASE d21 CHARACTER SET=utf8 COLLATE utf8_general_ci";
$sql="CREATE DATABASE moodle124567 COLLATE utf8_unicode_ci";
if (mysqli_query($con,$sql))
{
echo "Database my_db created successfully";
}
else
{
echo "Error creating database: " . mysqli_error($con);
}
//Creating moodledata folder
mkdir("../../moodledata");
//Creating configfile for moodle
$myFile = "config.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "
<?php
unset(\$CFG);
global \$CFG;
\$CFG = new stdClass();
\$CFG->dbtype = 'mysqli';
\$CFG->dblibrary = 'native';
\$CFG->dbhost = 'localhost';
\$CFG->dbname = 'moodle124567';
\$CFG->dbuser = 'root';
\$CFG->dbpass = '123456';
\$CFG->prefix = 'mdl_';
\$CFG->dboptions = array(
'dbpersist' => 0,
'dbsocket' => 0,
);
\$CFG->wwwroot = 'http://localhost/moodle';
\$CFG->dataroot = dirname(__FILE__);
\$CFG->directorypermissions = 0777;
\$CFG->admin = 'admin';
require_once(dirname(__FILE__) . '//lib//setup.php');
";
fwrite($fh, $stringData);
fclose($fh);
echo 'file created succesfully';
header("Location: http://localhost/moodle");
//////////////////////////////////////////////////////
My config file looks something like this after creation
<?php
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle124567';
$CFG->dbuser = 'root';
$CFG->dbpass = '123456';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array(
'dbpersist' => 0,
'dbsocket' => 0,
);
$CFG->wwwroot = 'http://localhost/moodle';
$CFG->dataroot = 'D://softwares//moodle1//wamp//moodledata';
$CFG->directorypermissions = 0777;
$CFG->admin = 'admin';
require_once(dirname(__FILE__) . '//lib//setup.php');
Thanks in advance.