[HELP] How to create the file install.php

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

Post Reply
spaxy
Forum Newbie
Posts: 2
Joined: Sun Feb 08, 2009 9:04 am

[HELP] How to create the file install.php

Post by spaxy »

Image


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", "");
?>
 
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: [HELP] How to create the file install.php

Post by Weirdan »

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

Re: [HELP] How to create the file install.php

Post by spaxy »

Thank you!! :P :P :P :P
Post Reply