attaching sqlite instead of giving a path

Hello ,

i want to distribute my php app as standalone app instead of making user choose the path and do some hardwork , as most of my clients are living abroad and don’t know how to setup the php app .

i distribute my app using php nightrain .

i can normally give path if i manually write the php code


<?php
   class MyDB extends SQLite3
   {
      function __construct()
      {
         $this->open('combadd.sqlite');
      }
   }
   $db = new MyDB();
   if(!$db){
      echo $db->lastErrorMsg();
   } else {
      echo "Opened database successfully
";
   }
?>

however in script , i have to give full path .

which is a little complicated when you dont know where will the user will put the app folder .

can you please help by give us a way to make sqlite , attached or included into project folder .

or inform me where does connection information saved .

okay to be honest it is not that easy, because even if you managed to get that, there will be the production environment setup part which the user will need to do it as well, and that is basically require knowing all the information about the database server. I guess it is a good idea to offer free installation for your clients instead of showing them errors and fix later… just my 2 cents :slight_smile:

take a look at this… might be helpful

SC_CONNECTION_EDIT

http://www.scriptcase.net/scriptcase-samples/tutoriais/systems/multiple_databases.php

Regards

@MikeDe
scriptcase team can create a folder that have the db , as sqlite dont need to have a server and its a standalone db , so they can have a folder to include the attached db , that will be better than asking user a path that could be different every time he run the app .

@kafecadm ,

that still asking me to setup a connection , i want user bypass that .

they tmleeek.

Since you know how to use the sc_connection_edit now you can ship your desired connection info into a .txt file… load it and read the info from such file at execution. SC WILL ALLWAYS ASK FOR YOU TO CONFIGURE A CONNECTION… I’m affraid there’s nothing you can do about it sunce is wired that way.

Regards

Well this is partly true. The connection info is stored in a file in _lib\conf\prod.config and this one you can change a bit.
My thought on this is: you setup a working deployment then you pack the whole bundle (uniserver/wamp/… with your project) together in a self unpacking exe and you are almost done. You would possible need to set firewall settings and so tho. So on windows there may be some extra work.

Be aware I havent tested this so I may be wrong in it. It is wworth trying with it tho.

good idea rr, but needs testing, because kafecadm and my preiouvs response still make sense :smiley:

ok one more thing to add it to learn more about silent installation, there might be hidden stuff of wamp that need to be packed as well, also xamp can do, they have good forum with lots of info, perhaps some more info in packing that package will be needed

if you got luck dear please let us know, interesting

good luck though