Hello ,
I have Add this router in the index router :
// install
public function install(Request $request, Response $response, array $args): Response
{
return $this->runPage($request, $response, $args, "install");
}
// Index
public function index(Request $request, Response $response, array $args): Response
{
if(Config("INSTALLED") == 0){
$url = "install";
} else {
etc....
}
}
Now , What I am try to do is redirect to installation page if Config(“INSTALLED”) == 0 before the app start use connection values to the database,
becoz the database connecting information is used as default values, So when new customer open the app for first time he got an error connect to database instead redirect to the install page if was this first time used the app so the install config value will be as 0 ,
so how can redirect the customer before the app start use connection values ?
Thanx …
The question is, how will you change the Config(“INSTALLED”) from 0 to another value? Because if you don’t change this value, then your end-users will always be redirected to the installation page.Another question, how will you save the database connection that will define by your end-users?
I simply store the data given by customer and then I use “fwrite()” function to write the config file based that stored data , then change the install value to 1
it’s away to make project installation easy to the customer
Thanx for replay
it’s work fine, but when using the default database connection values
I still get this error :An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘root’@‘localhost’ (using password: NO)that mean the app still check the sql connection before check the installation value , so it’s does not redirect to the install page
I suggest you to separate the business logic between installation and accessing the ready-web application. In other words, you should use special treatment for installation, and not using the feature from the generated web application.
Many PHP scripts out there that have functionalities to collect database connection info from end-users before installing the web application.