PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
spaxy
Forum Newbie
Posts: 2 Joined: Sun Feb 08, 2009 9:04 am
Post
by spaxy » Sun Feb 08, 2009 9:29 am
Help me create a file install.php
I do not know how
Just started studying php
This code file /inc/conf.php
Code: Select all
<?php
define("DIRECTORY", "");
$statistical_database = "";
$statistical_database_host = "";
$statistical_database_login = "";
$statistical_database_password = "";
define("statistical_database_host", "");
define("statistical_database", "");
define("statistical_database_login", "");
define("statistical_database_password", "");
$database = "";
$database_host = "";
$database_login = "";
$database_password = "";
define("database_host", "");
define("database", "");
define("database_login", "");
define("database_password", "");
?>
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Sun Feb 08, 2009 10:35 am
Code: Select all
// conf.php
<?php
define("DIRECTORY", "@directory@");
$statistical_database = "@statistical_database@";
$statistical_database_host = "@statistical_database_host@";
$statistical_database_login = "@statistical_database_login@";
$statistical_database_password = "@statistical_database_password@";
Code: Select all
// install.php
$conf = array(
'@directory@' => '/var/www/host/name',
'@statistical_database@' => 'stat_database',
'@statistical_database_host@' => 'localhost',
'@statistical_database_login@' => 'root',
'@statistical_database_password@' => 'pass',
);
file_put_contents('conf.php', str_replace(array_keys($conf), array_values($conf), file_get_contents('conf.php')));
spaxy
Forum Newbie
Posts: 2 Joined: Sun Feb 08, 2009 9:04 am
Post
by spaxy » Sun Feb 08, 2009 10:59 am