Abhijeet
Abhijeet

Reputation: 31

How can I make an installer for a PHP application?

I have a PHP application and would like to create an installer for it. Are there any existing frameworks I can use? Are there any good tutorials on this sort of thing?

Upvotes: 3

Views: 7179

Answers (4)

ncn
ncn

Reputation: 11

PHP script installation system create

image preview

create two new folder(include and install) in your root folder(htdocs). create new file connect.php and DB_Info.php in include folder | open connect.php in code editor and write @mysql_connection code in connect.php | Always use connect.php file Include/Require File For Connecting Database |

<?php  // Always Include/Require This File For Connect Database
    require_once "DB_Info.php";  // this is connect.php file

    @mysqli_connect(
        $HOST_name,
        $DB_username,
        $DB_password
    ) or die(
        "<h2>Database Error, Contact With Admin </h2>"
    );

    @mysqli_select_db(
        $DB_name
    ) or die(
        "<h2>Database Error, Contact With Admin</h2>"
    );
?>

require_once DB_Info.php keep blank | you can see in connect.php $HOST_name, $DB_username, $DB_password var have not value | we provide value in on the fly with form in DB_Info.php(require file) | now create index.php , installing.php , installed.php three file into install folder 1st index.php create form ->

<link rel='stylesheet' href='style.css' />

<?php  // create form
    $HOST_name = "<input class='input' type='text' name='dbhost' placeholder='Enter Host Name' />";
    $DB_username = "<input class='input' type='text' name='dbuser' placeholder='Enter DB User Name' />";
    $DB_password = "<input class='input' type='password' name='dbpass' placeholder='***********' />";
    $DB_name = "<input class='input' type='text' name='dbname' placeholder='Enter DB Name' />";
    echo "<div class='box' >
            <form class='ins' method='post' action='installing.php' >
                    <p>Enter Host Name:<p>
                    $HOST_name
                    <p>Enter DB User Name:<p>
                    $DB_username
                    <p>Enter DB PassWord:<p>
                    $DB_password
                    <p>Enter DB Name:<p>
                    $DB_name
                    <input class='submit' type='submit'name='install' value='NEXT' />
            </form>
        </div>";
?>

form action is installing.php now we using file handling function fwrite() for write three var value into DB_Info.php (connect.php $HOST_name, $DB_username, $DB_password) installing.php->

<link rel='stylesheet' href='style.css' />
<?php  
    $writer="<?php".'
    '.'$HOST_name = '."'".$_POST['dbhost']."'".';
    '.'$DB_name = '."'".$_POST['dbname']."'".';
    '.'$DB_username = '."'".$_POST['dbuser']."'".';
    '.'$DB_password = '."'".$_POST['dbpass']."'".';
    '."?>";

    $write=fopen('..\include/DB_Info.php' , 'w');
    if(empty($_POST['dbhost']&&
             $_POST['dbname']&&
             $_POST['dbuser']&&
             $_POST['dbpass'])){
                 echo"<h2 align=center >All Fields are required! Please Re-enter</h2>";

    }else{
        if(isset($_POST['install']))
        {
            fwrite($write,$writer);
            fclose($write);
            echo "<div class='box'>
                <form class='ins' action='installed.php' method='post'>
                    <h2 align=center color=red>Database Info Succecfully Entered<h2>
                    <input class='submit' type='submit' value='NEXT' name='next'/>
                </form>
                </div>";
        }else{ echo "<h2 align=center >Error<h2>"; }}
?>

last step installed.php for creating table into phpmyadmin ->

<?php
    if(isset($_POST['next'])){
        /*  enter your
         sql code for
         teble creating */
        echo"<h2 align=center >Finished</h2>";
    }else{
        echo"<h2 align=center >Error</h2>";
    }
?>

our css

* {
    margin: 0;
    padding: 0;
}

.box {
    position: absolute;
    width: 300px;
    top: 16%;
    left: 35%;
    background-color: rgb(0, 0, 0);
    padding: 15px;
    padding-top: auto;
}

.ins {
    margin: 0;
    padding: 0;
    font-weight: bold;
    color: lawngreen;
    font-size: 1rem;
}

.input {
    border: none;
    border-bottom: 2px solid lawngreen;
    margin-bottom: 20px;
    width: 100%;
    height: 40px;
    background: transparent;
    outline: none;
    color: cyan;
    font-size: 1rem;
}

.submit {
    background-color: lawngreen;
    width: 100%;
    height: 40px;
    font-size: 1.5rem;
    border: none;
    margin-top: 10px;
    outline: none;
    cursor: pointer;
    border-radius: 20px;
}

Upvotes: 1

Ketan
Ketan

Reputation: 1517

Do have a look at http://winbinder.org/ and http://gtk.php.net/ .

These tools help you in creating desktop applications using PHP as the programming language.

Upvotes: 0

user499054
user499054

Reputation:

Installer?

If you're installing a PHP script/setting some settings/etc, then yes. vBulletin and phpBB have some awesome 'installers' -- they create a configuration file without the need to get dirty.

However, if you're talking about a Windows/Linux/OS X/etc. executable installer, I don't think you can.

Upvotes: 0

Luis
Luis

Reputation: 6001

What you need is not an installer but a compiler.

Have a look at this article:

http://www.swiftlytilting.com/2005/03/21/phc-a-php-to-exe-compiler/

Upvotes: 2

Related Questions