Documentation/Launching the application/Website hosting

Installation and Hosting Launch

The installation requirements may vary on different hosting providers, but there are basic nuances that will be noted here.


#Disabling DEBUG Mode

Debug mode should be disabled on any public server, and hosting servers are no exception.
To separate settings from local development, copy the file /config/common.php as /config/common-local.php and disable the debug mode in the first, and enable it in the second.
Now, if the file /config/common-local.php is not uploaded to the hosting server, the settings will differ.


#Strict Project Structure

Often on hosting servers, the public folder is named public_html, but it could be different. To use this folder, simply rename the public folder in a project with the framework. Learn more about changing the public folder name.

It's possible that the hosting recommendations suggest placing the project in public_html, but according to the framework structure, it should be placed one directory higher to ensure alignment of public folders when migrating data.


#Using Databases

The hosting provider will likely provide a database and a method to connect to it. These settings may differ from local development settings. To resolve this, create a copy of the file /config/database.php, name it /config/database-local.php and set the hosting settings in the first, and local settings in the copy. Now, if the file /config/database-local.php is not transferred to the hosting server, the settings will be distinct.


#Task Scheduler

The framework includes both built-in console commands and those defined by the developer. If the host offers a task scheduling mechanism, these console commands can be scheduled as tasks.

You may need to specify the full path to the PHP executable when setting a task in the scheduler.
For example:

/usr/local/bin/php8.2 ~/project/dir/console rotate-logs 5

An alternative to running console commands manually is using a special Web Console of the framework.

Swoole Server Routing

Page translated: chatgpt 4-o
Back to top